In a Windows Forms application I'm saving some data to an Excel file. Until now, i was using Excel 2003 and saving as the file as xls. with this code :
exportFile.SaveAs(strPath, Excel.XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlShared, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
I've upgraded to Excel 2007 and now I want to save the data as xlsx, so i've changed the same line to :
exportFile.SaveAs(strPath, Microsoft.Office.Interop.Excel.XlFileFormat.xlOpenXMLWorkbook, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlShared, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
But now, i get an exception on that line , "Exception from HRESULT: 0x800A03EC" Do you have any idea what am i doing wrong ?
Thank you!
I've tried @david heffernan's solution and worked. XlSaveAsAccessMode.xlNoChange did the trick
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.