Microsoft.Office.Interop.Excel not registered DLL

using Microsoft.Office.Interop.Excel.dll

results in the following error:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll

Additional information: Retrieving COM factory class for component with CLSID {00020819-0000-0000-C000-000000000046} failed due to the following error: 80040154 Klasse nicht registriert (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

The error occurs on the fourth line of this code:

 using EX = Microsoft.Office.Interop.Excel;

 private void LoopBANFDokumenteLibrary(System.Uri Link)
 {
        EX.Application MSExcel = new EX.Application();
        EX.Workbook WB = MSExcel.Workbooks.Add(new EX.Workbook()); //ERROR: Exception thrown
        EX.Worksheet WS = WB.Worksheets.Add(new EX.Worksheet());
        /*...and further code...*/
 }

      

Several years ago I used this Interop.Excel.DLL on a daily basis and have never encountered this problem. Opening regedit.exe, dll is registered as you can see in this screenshot:

regedit

Does anyone have any idea what is wrong?

Best regards and thank you Jan

+3


source to share


1 answer


Change

EX.Workbook WB = MSExcel.Workbooks.Add(new EX.Workbook());

      

to



EX.Workbook WB = MSExcel.Workbooks.Add();

      

Similarly use

EX.Worksheet WS = WB.Worksheets.Add();

      

+1


source







All Articles