Set oWrkBook = oExcel.Workbooks.Add 'create a new file 'if adding a workbook the make sure to check if it already exists oWrkBook.SaveAs "c:\THETEST2.XLS" 'naming new file or renaming old
Thanks, Corinna Robertson Boston Software Systems [EMAIL PROTECTED] www.bostonworkstation.com The Essential Tool for Healthcare Integration 866-653-5105 x 8 603-598-5122 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Zimmerman, Scott Sent: Friday, January 09, 2004 10:54 AM To: BostonWorkstation Talk (E-mail) Subject: [Talk] Naming excel worksheet Part of a script I am writing creates a new worksheet in exceI which will be used to capture errors daily from the script. I can create the new sheet no problem but since it is an additional sheet everyday (new log everyday) I won't know the name by which to reference it and be able to rename it. I have pasted the section that does this work but what I have so far doesn't do anything. Any ideas?? ExcelApp.Worksheets.Add 'Add a new sheet to the Excel File ExcelApp.Worksheets(ExcelApp.ActiveSheet).Name = strErrorWorksheet 'Rename the new sheet, appears to only respond when the original sheet name is used ExcelApp.Worksheets(strErrorWorksheet).Move after:=ExcelApp.Worksheets(strSheet) ExcelApp.Worksheets(strErrorWorksheet).Range("A1:Z1000").ClearContents ExcelApp.Worksheets(strSheet).Select Scott Zimmerman, LIS Analyst UMass Memorial LIS Department Phone: 508-334-7237 Pager: 508-426-2178 > "The information transmitted is intended only for the person or entity > to which it is addressed and may contain confidential and/or > privileged material. Any review, transmission, re-transmission, > dissemination or other use of, or taking of any action in reliance > upon this information by persons or entities other than the intended > recipient is prohibited. If you received this in error, please contact > the sender and delete the material from any computer." > >
