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!

Moving a file from a folder to another via vba

Status
Not open for further replies.

Enkay62

Programmer
Sep 5, 2003
78
IT
Hi.
I'm trying to write a sub to move a file from folder1 to folder2 (e.g.).
I tested this

File.Move "C:\Folder1\Myfile.xls" , "C:\Folder2\Myfile.xls"

but it doesn't work.

Where am I wrong?

(Moreover: can I move a shortcut file too?)

Thank you in advance for your suggestions.

Nick
 
you can do this very easily w/ the filesystemobject:

Dim fs
Set fs = CreateObject("Scripting.FileSystemObject")
fs.movefile [sourcefile], [destinationfile]
Set fs = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top