using Excel = Microsoft.Office.Interop.Excel;
I need to save an excel file (.xls) from my datagridview. Everything works fine, writing data, changing cell format, etc. But the problem arises when saving the document.
string format = "yyyy_MM_dd_HH-mm";
string pathtoexport = @"C:\DM\SMS\Przychodzace\Znalezione_SMS_" + DateTime.Now.ToString(format) + ".xls";
oWB.SaveAs(pathtoexport, Excel.XlFileFormat.xlWorkbookNormal, missing, missing,
false, false, Excel.XlSaveAsAccessMode.xlNoChange,
missing, missing, missing, missing, missing);
}
OK, a few days ago it worked, but now it can only say
HRESULT: 0x800A03EC "}
I need .xls to import it into SQL. Any tips?
Before the problem was in Excel.XlFileFormat.xlWorkbookDefault, when Iv changed it to Normal, everything was fine. Now it does not work. LOST a lot of time to process it myself using Google, but I couldn’t.
oWB.SaveAs(MyFile + @"C:\SMS\XMLCopy.xls",
Excel.XlFileFormat.xlWorkbookNormal, missing, missing,
false, false, Excel.XlSaveAsAccessMode.xlNoChange,
missing, missing, missing, missing, missing);