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

FileCopy errors 2

Status
Not open for further replies.

stillwillyboy

Technical User
Jan 22, 2004
165
US
I keep getting error messages when I try to copy a file from one folder to another. Here is my code:

Sub SendFileToADPFolder()
Application.DisplayAlerts = False
Dim SourceFile, DestinationFile
' Define source file name. 'note there is a space b/w
' the words "Microsoft" and "Office"
SourceFile = "C:\Program Files\Microsoft Office\Excel\OutsourceXfer\PRVY6EPI.csv"
' Define target file name.
DestinationFile = "C:\Program Files\Microsoft Office\Excel\OutsourceXfer\FakeADPFolder\"
‘’I tried the following and got the Path Not Found error
'FileCopy SourceFile, DestinationFile ' Copy source to target.

‘when I tried the following, I got “object required”
SourceFile.Copy DestinationFile

End Sub

TIA,

Bill
 
Looks like you need to specify the file name also.
 
And this ?
SourceFile = "C:\Program Files\Microsoft Office\Excel\OutsourceXfer\PRVY6EPI.csv"
' Define target file name.
DestinationFile = "C:\Program Files\Microsoft Office\Excel\OutsourceXfer\FakeADPFolder\PRVY6EPI.csv"
FileCopy SourceFile, DestinationFile ' Copy source to target

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top