Search code examples
c#excelcomexceptioninteropservices

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.


Solution

  • 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 !