title: Saving an Excel Workbook on the Server through ASP.NET and IIS7
body: <p>The following code samples produce the same error when I perform the SAVEAS:</p>
  
  <pre><code>Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
  filePath = (string.Format("{0}.{1}", Path.GetTempFileName(), "xls"));
  </code></pre>
  
  <p>...do some stuff to the workbook ...</p>
  
  <pre><code>excelApp.DisplayAlerts = false;
  excelApp.ActiveWorkbook.SaveAs(filePath)
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>Missing m = Missing.Value;
  excelApp.ActiveWorkbook.SaveAs(filePath, m, m,m,m,m, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, m,m,m);
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>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);
  </code></pre>
  
  <p>Here's the error:
  Exception: <strong>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)</strong></p>
  
  <p>I had the Office 2003 interops on the server but have upgraded to 2007. No difference.</p>
  
  <p>Incidentally, I can write a text file to the same file/path so it's not a permissions error on the folder.</p>
  
  <p>Thanks in advance,</p>
  
  <p>Jim</p>