Excel.Application Exception

-1

In main part of application I call this line:

Excel.Application ExcelApp = new Excel.Application();

It give me an exception:

System.Runtime.InteropServices.COMException: 'Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).'

I tried to run debug in x86, x64 modes is the same result.

enter image description here

c#
excel
asked on Stack Overflow Apr 3, 2019 by OPV • edited Apr 3, 2019 by OPV

1 Answer

1

Try declaring them like this, fully qualified:

Microsoft.Office.Interop.Excel.Application xlapp = new Microsoft.Office.Interop.Excel.Application();

                 Microsoft.Office.Interop.Excel.Application xlApp;
                 Microsoft.Office.Interop.Excel.Workbook xlWorkBook;
                 Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet;
answered on Stack Overflow Apr 3, 2019 by Alex M

User contributions licensed under CC BY-SA 3.0