I have an Excel file which gives error while opening it manually:
excel found unreadable content in *****.xlsx. Do you want to recover the content of this workbook? If you trust this workbook click yes.
If I click yes, I can open it in usual way, but if I use:
Excel.Application oExcelApp;
Excel.Workbook excelWorkbook = oExcelApp.Workbooks.Open(workbookPath, 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false);
I am getting a COMException:
Exception from HRESULT: 0x800A03EC
How to handle this exception. How can I make it open or show that error which is shown everytime I open it manually.
I am using MS Office 2010.
Try to change your 4th parameter type to XlFileFormat (enumeration) and choose the a fitting value (enum description). Maybe 5 (xlWK1 value in enum) is the wrong one...
for example
Excel.Application oExcelApp;
Excel.Workbook excelWorkbook = oExcelApp.Workbooks.Open(workbookPath, 0, false, Excel.XlFileFormat.xlWorkbookDefault, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With