Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Renaming a file

Status
Not open for further replies.

Enkay62

Programmer
Sep 5, 2003
78
IT
Hi.
How can I rename a file (in a different directory) via vba?
Thank you.
Nick
 
Hi,
Use the SaveAs Method.

There are several arguments, so I can't tell you what you'll need, but the simplest is...
Code:
ActiveWorkbook.SaveAs FName
where FName is the path and filename.

Hope this helps :)

Skip,
Skip@TheOfficeExperts.com
 
use the copy command to copy to a new location, then use the kill command to remove the original.

Hope this helps
 
use the filesystemobject, way easier than the copy command and kill command and its a standard VBA object.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top