ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SaveCopyAs generating the 0x800a03ec exception (https://www.excelbanter.com/excel-programming/380090-savecopyas-generating-0x800a03ec-exception.html)

PromisedOyster

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);



All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com