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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy Paste Files Non MS using a Macro 1

Status
Not open for further replies.

johnbailey

Technical User
Jul 3, 2002
8
GB
I am trying to use a macro to copy a .pdf file and then paste it to another directory. Is it possbile with the usual VBA?
Thanks
John
 
Hi John
The following will do the trick no probs

Sub x()
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
fso.copyfile "\\your source path\..\pcounterorderform.pdf", "c:\"
End Sub

Copy file has a third argument which is 'Overwrite' ie overwrite the file if it already exists. The default is True, as in this case. If you change it to false and the file exists you will get a trappable error.

3 days to go
;-) If a man says something and there are no women there to hear him, is he still wrong?
 
Loomah,

Brilliant thanks, it worked perfectly.

Cheers
John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top