4

I am getting the below error when instantiating the Microsoft.Office.Interop.Excel.Application() for generating Excel from the winforms app.

This was working before and suddently it stopped working eventhough there was no change in code and in version of excel. Only change I could see is there were some windows 10 updates getting installed in past weeks but I am not sure whether that was the cause for the problem

retrieving the com class factory for component with clsid {00024500-0000-0000-c000-000000000046} failed due to the following error : 800700c1.

I could see many solutions for access denied (error: 80070005 Access is denied) for the same type of operation, but none for error : 800700c1.

I am running the application in 32 bit and I have re-installed the office 2016 (32-bit) suite but still I am getting the error.

Any help in direction of solving would help.

4
  • Is your Windows a 64-bit version as discussed here? Jun 21, 2018 at 14:09
  • 0x8007 indicates a Windows error, 0x00c1 indicates the error code. 193 = ERROR_BAD_EXE_FORMAT = "not a valid Win32 application". The 99% case is trying to load a 32-bit DLL into a 64-bit process or the other way around. In C# always make sure to untick the Prefer 32-bit option so the code can run either way. The OS loader can provided fine-grained diagnostics, google "windows show loader snaps" to find out how to do that. Jun 21, 2018 at 14:09
  • My Windows 10 system is 64 bit version from start and winforms app is set as x86, as mentioned before there was no change in winforms app and this error happens only in few systems. I can only built winforms app as 32 bit because i have some other dll's which can be used only in 32 bit applications.
    – Vignesh AJ
    Jun 21, 2018 at 15:40
  • FYI ,Build the application is using AnyCPU still getting the same error
    – Vignesh AJ
    Jun 22, 2018 at 7:57

3 Answers 3

9

Deleting the file "C:\Program" fixed the issue. No idea how the file was created and why deleting it solve the excel generation problem.

1

In my case c:\Program was created by Notepad++, and yes removing it did help.

0

Just to piggyback off of Vignesh AJ's solution, this Program file seems to have appeared after a Citrix Workspace for Windows update. The file can be moved or deleted from C drive to solve the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.