SaveCopyAs generating the 0x800a03ec exception

P

PromisedOyster

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.GetActiveObject("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);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top