Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel.Application Exception

Tags:

c#

excel

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

like image 956
OPV Avatar asked Aug 01 '26 17:08

OPV


1 Answers

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;
like image 198
Alex M Avatar answered Aug 04 '26 05:08

Alex M



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!