renaming workbooks

Hi,

I've about 60 workbooks in a directory  ;- C:\Reports\

Each workbook is a persons name and I need to change this
  instead of

Salesperson1.xls,
Salesperson2.xls,
Salesperson3.xls

etc,

I need to put  the words Report Document in  front of each workbook

so the name of each workbook is now

Report Document  Salesperson1.xls
Report Document  Salesperson2.xls
Report Document  Salesperson3.xls

etc.
Any help would be much appreciated.

Regards,

linnanda

LINNANDAAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

William ElliottSr Tech GuruCommented:

strfolder = "C:\reports\"
 
set fso = createobject("Scripting.FilesystemObject")
set myfolder = fso.GetFolder(strfolder)
 
for each file in myfolder.files
 
   if lcase(right(file.name, 3)) = "xls" then
     fso.CopyFile strfolder & file.name , strfolder & "Report Document " & file.name
   end if  
next

Open in new window

0
William ElliottSr Tech GuruCommented:
save the above script in notepad.,. cal it "report_rename.vbs" and double click on it.
0
LINNANDAAuthor Commented:
Thanks weellio, that worked fine however then original files are still present, is there any way to delete the orginal files
0
William ElliottSr Tech GuruCommented:
oh...
change
 fso.CopyFile
to
 fso.moveFile
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LINNANDAAuthor Commented:
Thanks weellio, that worked fine.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.