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.
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);
current cell and I call the SaveCopyAs method, then I get exception
0x800a03ec thrown.
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);