Re: Saving Excel File
Matthew Wills <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.winforms |
|---|---|
| Message-ID | <OF1C5BF6A4.B4220BEC-ONCA2572AB.00832DA4-CA2572AB.0083391F@nab.com.au> |
Steve, _WorkBook.SaveAs(NewFileName) Seeya Matthew Wills | Senior Analyst Programmer / Solution Designer | Adviser Tools and Services | Financial Planning and Third Party | NAB Technology Phone: 02 9957 8183 | Mobile: N/A | Email: [email protected] |---------+----------------------------> | | Steve Abaffy | | | <steve@MSMARKETIN| | | G.BIZ> | | | | | | | |---------+----------------------------> >------------------------------------------------------------------------------------------------------------------------------| | | | To: [email protected] | | cc: | | Subject: [DOTNET-WINFORMS] Saving Excel File | >------------------------------------------------------------------------------------------------------------------------------| 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 ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ National Australia Bank Ltd - ABN 12 004 044 937 This email may contain confidential information. If you are not the intended recipient, please immediately notify us at [email protected] or by replying to the sender, and then destroy all copies of this email. Except where this email indicates otherwise, views expressed in this email are those of the sender and not of National Australia Bank Ltd. Advice in this email does not take account of your objectives, financial situation, or needs. It is important for you to consider these matters and, if the e-mail refers to a product(s), you should read the relevant Product Disclosure Statement(s)/other disclosure document(s) before making any decisions. If you do not want email marketing from us in future, forward this email with "unsubscribe" in the subject line to [email protected] in order to stop marketing emails from this sender. National Australia Bank Ltd does not represent that this email is free of errors, viruses or interference.