View Single Post
  #2   Report Post  
Ato Bisda
 
Posts: n/a
Default

Hello,

The code below should do the job assuming you have Excel installed:
--------------------------------------------------------------------
yourXlsFile = "c:\yourFolder\yourFile.xls"

Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open(yourXlsFile)
xlBook.Worksheets(1).Name = xlBook.Name
xlBook.Close 1
xlApp.Quit

Set xlBook = Nothing
Set xlApp = Nothing
--------------------------------------------------------------------
Regards,
Ato

"Dragon" wrote in message ...
Hi,

I have 4 Excel files that are created on a regular basis. Each file has one
worksheet. I need to find an automated method (VB Script?) that will simply
rename the worksheets within the files to the name of the file. For Example,
if I have a File1.xls with Sheet1 in it, script will simply rename the
Sheet1 to File1 or File1.xls. I need to do this to all my 4 files on a
regular basis so I will simply schedule this script. I need this method
outside excel so that it is portable. If I need to have either Excel or
Excel viewer, it is ok as well.

Thank you.