VBA to move an excel file to another folder

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I want to write a macro that takes an existing excel file (workbook) and
place it in another folder. Basically something that would simulate cutting
a file from one folder and pasting it in another. Is this possible using
VBA? If it is, what would be the code or where can i find the code to do so?
Thanks!
 
Hi

It's very easy, given that the file and the to-folder already exist:

Sub MoveFile()
Name "C:\Temp\Book1.xls" As "C:\Junk\Book5.xls"
End Sub

HTH. Best wishes Harald
 
Look up Name in VBA's help.

Or even FileCopy and Kill.

These options will work if that file (doesn't have to be an excel workbook)
isn't open.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top