Thank you everyone for your suggestions.  Here is what worked for me in case
anyone needs to do this:

oExcel.Worksheets.Add ' add a worksheet
oExcel.ActiveSheet.Name = "NewSheetName"

Once you add the new sheet it should become the active (or selected sheet).

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."  
> 


-----Original Message-----
From: White,Scott A [mailto:[EMAIL PROTECTED]
Sent: Monday, January 12, 2004 9:29 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [Talk] Naming excel worksheet


Hello,
Would it help if you were to assign today's date to a variable
and then use that variable ($str) as part of your file name?

Then each day you would have a unique file name created.

Scott

-----Original Message-----
From: Zimmerman, Scott [mailto:[EMAIL PROTECTED]
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."  
> 
> 
CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may
contain confidential and privileged information for the use of the
designated recipients named above.  If you are not the intended recipient,
you are hereby notified that you have received this communication in error
and that any review, disclosure, dissemination, distribution or copying of
it or its contents is prohibited. If you have received this communication in
error, please notify Saratoga Hospital immediately by e-mail at
[EMAIL PROTECTED] and destroy all copies of this communication and
any attachments.

Reply via email to