Workaround for exporting Excel "exception from HRESULT:0X800A03EC" error (verified)
It's hard to find an error that resolves the export data to Excel where "exception from Hresult:0x800a03ec" occurs.
Searching for solutions from Google, the online solution basically says that the starting line's subscript value is written in the 0 resulting "Excel." Cells[0, 1] = "1th row 1th column"; ", instead of more than 0 can be resolved, and so these are not effective. Insert Breakpoint, debug program, and "Cannot step into" error. Later, I looked at the anomaly carefully and found that the exception was from
"Excel. ActiveWorkbook.SaveAs (FilePath + filename, Excel.XlFileFormat.xlExcel9795, NULL, NULL, FALSE, FALSE, Excel.XlSaveAsAccessMode.xlNoChange, NULL, NULL, NULL, NULL, or NULL); This statement jumps out, and if I start writing the small label of the data row from 0, the exception will jump out of the line when it is written. The problem may be found in the argument of this statement, so the statement was arbitrarily changed to "Excel." ActiveWorkbook.SaveAs (FilePath + filename, Excel.XlFileFormat.xlExcel7, NULL, NULL, FALSE, FALSE, Excel.XlSaveAsAccessMode.xlNoChange, NULL, NULL, NULL, NULL, or NULL); Found to solve the problem.
This is probably the wrong version of my Excel (my Excel version is 2007), but using the 2003 library, actually changed the EXCEL.XLFILEFORMAT.XLEXCEL7 to " xlWorkbookNormal"best.
Note: FilePath + filename: I'm using Filename.xls, and using filename.xlsx will cause problems.
Workaround for exporting Excel "exception from HRESULT:0X800A03EC" Error (verified)