Saving Excel File
Steve Abaffy <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.winforms |
|---|---|
| Message-ID | <01be01c77097$850469a0$8f0d3ce0$@biz> |
I have the following code
_Application ExcelObjOut = new ApplicationClass();
Workbooks workbooks = ExcelObjOut.Workbooks;
_Workbook Workbook = workbooks.Add(XlWBATemplate.xlWBATWorksheet);
_Worksheet Sheets = (_Worksheet)Workbook.ActiveSheet;
Range Range;
//NewFile name is generated from an OpenDialogBox FileName so the path is
included
NewFileName = FileName.Substring(0,FileName.IndexOf(".")) + Processed.xls";
//Add stuff to NewFile (This works fine)
// This line does not save the new file as NewFileName it asked me to save
Sheet1 opens up a save dialog box and allows me to save the file.
ExcelObjOut.Save(NewFileName);
// Then this line throws an exception that it can't find the NewFileName
file.
ExcelObjOut.Quit();
So the question I guess is how do you save a new Excel file that is being
generated on the fly after you get done putting your values in it?
Thanks