Moving a file from one folder to another

S

scantor145

Excel 2002 with Visual Basic 6.3

I have a file, say it's called test.txt, in C:\. During the course o
running a particular macro I would like to find that file, move it an
save it to another folder, say C:\My Documents.

Any ideas for the procedure?

Thank
 
G

Guest

Hi Scantor
try this one:

Dim fs
Set fs = CreateObject("Scripting.FileSystemObject")

FileCopy "c:\book1.xls","c:\My Documents\book1.xls" 'this one copy
fs.DeleteFile ("c:\book1.xls"), FORCE:=True 'this one delete

cheers
Miguel
 

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

Top