Hi,
The following code samples produce the same error when I perform the SAVEAS:
Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
filePath = (string.Format("{0}.{1}", Path.GetTempFileName(), "xls"));
...do some stuff to the workbook ...
excelApp.DisplayAlerts = false;
excelApp.ActiveWorkbook.SaveAs(filePath)
OR
Missing m = Missing.Value;
excelApp.ActiveWorkbook.SaveAs(filePath, m, m,m,m,m, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, m,m,m);
OR
excelApp.ActiveWorkbook.SaveAs(filePath, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, Missing.Value, Missing.Value, Missing.Value);
Here's the error: Exception: System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC at Microsoft.Office.Interop.Excel.WorkbookClass.SaveAs(Object Filename, Object FileFormat, Object Password, Object WriteResPassword, Object ReadOnlyRecommended, Object CreateBackup, XlSaveAsAccessMode AccessMode, Object ConflictResolution, Object AddToMru, Object TextCodepage, Object TextVisualLayout, Object Local) at Common.CreateTempExcelFile(DataTable data)
I had the Office 2003 interops on the server but have upgraded to 2007. No difference.
Incidentally, I can write a text file to the same file/path so it's not a permissions error on the folder.
Thanks in advance,
Jim