Błąd podczas otwierania skoroszytu programu Excel przy użyciu kodu C #
Próbuję otworzyć skoroszyt programu Excel i próbuję uzyskać w nim arkusz. Excelapp.workbooks.Open line rzuca wyjątek jako
System.Runtime.InteropServices.COMException z HRESULT: 0x800A03EC w Microsoft.Office.Interop.Excel.Workbooks.Open
Oto mój kod:
Excel.Application excelApp = new Excel.ApplicationClass();
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(strWBPath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,Type.Missing, Type.Missing, Type.Missing, true);
StrWbPath to moja lokalizacja w Excelu. Mam na myśli program Excel 2007 i dodałem Microsoft.office.interop.excel w wersji 12.0.0.0.