Microsoft.Office.Interop.Excel not registered DLL
使用
An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in mscorlib.dllAdditional information: Retrieving the COM class factory 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)).
该代码的第四行中出现错误:
1 2 3 4 5 6 7 8 9 | 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...*/ } |
几年前,我每天都使用此Interop.Excel.DLL,而且从未遇到过此问题。 打开regedit.exe,该dll已注册,如您在此屏幕截图中所见:
有人有想法吗,怎么了?
谢谢你,
一月
更改
1 |
至
1 | EX.Workbook WB = MSExcel.Workbooks.Add(); |
类似使用
1 | EX.Worksheet WS = WB.Worksheets.Add(); |