wisdom
wisdom

Reputation: 432

COMException with interopServices C# in Excel

I am facing a very annoying problem while installing my program on some machines, I have developed a C# application and everything goes OK and surely I tested it on another machines with no problem but when I am installing it on my client machine the following problem occurs:

System.Runtime.InteropServices.COMException (0x800A03EC): exception from HRESULT: 0x800A03EC at System.RuntimeType.ForwardCallToInvokeMember (String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) at Microsoft.Office.Interop.Excel.Range.set__Default(Object RowIndex, Object ColumnIndex, Object ) at SchoolMgmt.certificate_succession.sum_operation()

as the program communicates with Excel, Office Microsoft (I tried to install another Office version with no success).
I've searched a lot for a solution but nothing works as it's claimed the problem is just a permission issue in the following path

C:\Windows\ System32\config\SystemProfile

It is really driving me crazy why the program runs smoothly and successfuly on my testing machine but not on my client's !!
Any suggestion please.

Upvotes: 1

Views: 3905

Answers (2)

Etater
Etater

Reputation: 13

I got the same issue and after several trials I understood that some installed versions of Excel (2013) had set the options (general options) of compatibility with Excel 2003. In this case the new created file accepts only 255 columns and 65.535 rows. As my application was working on thousands of columns, excel was generating the error. The easy solution was to change the general options and set the "saved file format" to ".xlsx" instead of ".xls"

Upvotes: 1

wisdom
wisdom

Reputation: 432

After weeks and weeks of searching and digging out the hell problem I figured it out !.
It is just a problem with regional settings !! yes, I do not know why but Microsoft Office just works like that, regional settings from control panel should be English not any other language accepted as I was reading from different users.
So if you would like to play with Microsoft Office from C# application make sure that your regional settings are English et voila !

Upvotes: 3

Related Questions