View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
PromisedOyster PromisedOyster is offline
external usenet poster
 
Posts: 2
Default SaveCopyAs generating the 0x800a03ec exception

If I have a newly created Excel spreadsheet and I dont tab out of the
current cell and I call the SaveCopyAs method, then I get exception
0x800a03ec thrown. The user is in "edit mode" ie has typed something
into a cell but hasn't confirmed it

Any ideas on how to avoid this?

(What the code is doing is saving the current Excel workbook into our
database).

Abridged sample code:

try
{
o =
System.Runtime.InteropServices.Marshal.GetActiveOb ject("Excel.Application")*;

}
catch (System.Exception)
{
// Excel is not running
return;
}


_excelApp = o as Excel._Application;
// connect to current Excel workBook
_workBook = _excelApp.ActiveWorkbook;
if (_workBook == null)
{
// No workbook is currently defined
return;
}


_excelApp.DisplayAlerts = false;
_workBook.SaveCopyAs(excelFile);