Share via


Error loading type library/DLL (Microsoft.Office.Interop.Excel.Application)

Question

Tuesday, January 1, 2013 6:38 AM

I'm trying to create an Excel document via C#. When I run the application, it gives the following error:

Unable to cast COM object of type 'System.__ComObject' to interface
type 'Microsoft.Office.Interop.Excel.Application'. This operation
failed because the QueryInterface call on the COM component for the
interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due
to the following error: Error loading type library/DLL. (Exception
from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

It was working fine before I've upgraded **Visual Studio from 2010 to 2012**. I've also upgraded **Office from 2010 to 2013**. 

  • There are no errors/warnings at output window.
  • Microsoft.Office.Interop.Excel reference is added

All replies (2)

Wednesday, January 2, 2013 1:43 AM ✅Answered

I was struggling with this error for a few days . I've finally found the solution.

It occurs because I’ve installed Office 2013 instead of Office 2010 which I was using with old version of my project. After I upgraded my Office, the project was no longer able to link Excel reference.

Even though I referenced new Excel library which is 15.0, it didn't work.

What I did is that:

  • Delete the Excel reference (Microsoft.Office.Interop.Excel). Version 15.0, in my case.
  • Install Microsoft Excel (whichever version you had been using. Version 2010 for me)
  • Add the Excel reference (older one. Version 14.0, in my case)

Wednesday, January 2, 2013 6:27 AM

Hi Nedim,

Glad to see this issue has been resolved. Thank you for sharing your solutions here. In addition, if there are any issues about the Office, you could select the correct forum here. Thanks for your understanding.

Have a nice day,

Jack Zhai [MSFT]
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.