Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
saveCopyAs judith Excel Programming 1 September 29th 04 11:21 AM
SaveCopyAs Greg Hadrych Excel Programming 4 July 28th 04 07:49 PM
SaveAs problems Stuart[_5_] Excel Programming 3 March 7th 04 08:37 AM
SaveCopyAs Mark Worthington Excel Programming 4 February 8th 04 06:00 AM
Problems with active cell after saveas BrianG[_4_] Excel Programming 1 September 24th 03 11:27 AM


All times are GMT +1. The time now is 07:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"