Link to home
Start Free TrialLog in
Avatar of ckchew666
ckchew666

asked on

Copy file and rename it using VB

Hi,

I'd like to copy an existing (*'xls) file from a folder [C:\nbutane\rsview\report\] into the same folder but the new file will be rename.

FileCopy "C:\nbutane\rsview\report\FC Daily Report.xls", "C:\nbutane\rsview\report\FC Daily Report\" & Format(Date - 1, "ddmmmmyyyy") & ".xls"
End Sub

Source (original filename) : FC Daily Report.xls
Target (new filename) : FC Daily Report.xls 07112004.xls

Anyone can verify if the VB code above is correct? Thx.
   
ASKER CERTIFIED SOLUTION
Avatar of vippx
vippx

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ALL41_Eggy
ALL41_Eggy

Not really part of your question but you may find formatting the date as yyyymmdd will help you when it comes to sorting the list of files alphabeticallu, they will appear in date order.
Avatar of ckchew666

ASKER

Vippx,

Thx for ur code, you are realy good :)