Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to create object of Excel.Application

In my C# application i am importing and exporting data to excel. I have office 2013.

I am using following code:

using Excel = Microsoft.Office.Interop.Excel;
Excel.Application _excelApp = null;
_excelApp = new Excel.Application();

This code was working fine but recently i installed Microsoft project professional 2013, it also update office. After this i am getting error in _excelApp = new Excel.Application();

Error is:

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)).

like image 229
Deepak gupta Avatar asked Dec 13 '25 22:12

Deepak gupta


1 Answers

The problem has been resolved. When i installed Microsoft project professional 2013, it also update microsoft office, but the updation of office was not successful.

When i repair office, it started working fine.

like image 57
Deepak gupta Avatar answered Dec 15 '25 10:12

Deepak gupta