Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problems using SaveAs and SaveCopyAs
We have a C# application that is using the Excel object model via
Interop. The code below works fine for an existing workbook, ie one that you have opened up (or saved), but if you open up Excel, click the New button, enter some data and then run the program below, an Exception is thrown: Exception for HRESULT: 0x800A03EC on the call to SaveCopyAs object missing = System.Reflection.Missing.Value; object o = System.Runtime.InteropServices.Marshal.GetActiveOb ject("Excel.Application"); Excel._Application excelApp = o as Excel._Application; // connect to current Excel workBook Excel.Workbook workBook = excelApp.ActiveWorkbook; if (workBook == null) { throw new ApplicationException("No workbook is currently defined"); } // get temp file name to save document off to string fileName = "temp.xls"; workBook.SaveCopyAs(fileName); workBook.Close (missing ,missing ,missing); Is there a workaround, I have tried using the SaveAs method but to no avail. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
saveCopyAs | Excel Programming | |||
SaveCopyAs | Excel Programming | |||
SaveAs problems | Excel Programming | |||
SaveCopyAs | Excel Programming | |||
Problems with active cell after saveas | Excel Programming |