Unable to load excel file using Microsoft.Office > interop.Excel

0

In my WPF application I am using Microsoft.Office.Interop.Excel to import data from excel file. I have been using this code for last couple of months and it has been working just fine for me. Today all of a sudden when I ran the utility I got the following error.

Unable to cast COM object of type 'Microsoft.Office.Interop.Excel.ApplicationClass' 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: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).

I had originally Office 2013 installed but 2 months ago I uninstalled and installed the 2007 version. Everything was working fine until now.

I have read on different posts to delete the registry entry corresponding to the above IID. I have tried doing that but no help. I uninstalled/repaired Office as well but no help.

I have tried to register the Microsoft.Office.interop.excel.dll using regasm.exe as well but again no luck. Whats the issue here?

c#
excel
office-interop
asked on Stack Overflow Aug 16, 2015 by WAQ • edited Aug 16, 2015 by Uwe Keim

1 Answer

-2

I had a some problems with Interop. then I switched to Microsoft.Jet.OLEDB.4.0 don't know if it helps, but I found it to be much more stable.

answered on Stack Overflow Aug 16, 2015 by Teo

User contributions licensed under CC BY-SA 3.0