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

copyFile difficulties 1

Status
Not open for further replies.

c00ld00d

MIS
Jul 21, 2003
13
US
I'm trying to copy a set of files from one folder to another. I'm doing this locally for now, but in production this will be from the network to a local folder.

The code I am using is:

'Copy working files
fso.CopyFile src, dst, True
If Err Then
errorMsg = "Unable to copy working directory files: Error Copying Files"
updateSuccessful = False
Exit Function

When I run this code, the files actually copy, but I get the "Error # 5 Invalid procedure call or argument" error returned, which stops my script.

What am I doing wrong?

 
If Err Then
Try this:
If Err.Number > 0 Then

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Thanks PH. I made that change (which was a "DUH" on my part) but I still am getting the same error...
 
What are the value of src and dst ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Sorry, should have included that...

src = "C:\_NETWORK\*.*"
dst = "C:\_LOCAL\"
 
Have you tried this:
Err.Clear
fso.CopyFile src, dst, True
If Err.Number > 0 Then

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Thanks PHV, that seems to have done it. I guess I am used to VBA, where err is cleared automatically.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top