CopyFile error

bbulla

I'd rather be golfing
Local time
Today, 10:56
Joined
Feb 11, 2005
Messages
101
Hi,

I'm using the following line of code to copy a file from one drive to another:

fso.copyFile fileToCopy, "C:\Test"

I keep getting a 'Run-time error 70: Permission denied' error. I have tried to manually copy and paste the files, and it works fine. I have full read/write access to both of the file locations. Also, none of the files are currently being accessed by another application. The location of the fileToCopy is on a USB drive and C:\Test is my local hard drive.

Any ideas??
 
Hi,

I THINK that copyFile will not overwrite... You will probably need to test if the file exist and delete it before copying...

Simon B.
 
Any ideas??
Yep, you aren't giving the file name correctly. It thinks you want the folder:

fso.copyFile fileToCopy, "C:\Test.xls"

or if Test is the folder:

fso.copyFile fileToCopy, "C:\Test\FileName.doc"

Use the correct file extensions too (I just did this as a sample).
 
Thanks Bob. I just assumed it would use the same filename. Is there another method I could use other than FileSystemObject.CopyFile that would automatically bring the filename over with it??
 
Thanks Bob. I just assumed it would use the same filename. Is there another method I could use other than FileSystemObject.CopyFile that would automatically bring the filename over with it??
Why do you need to do that? Don't you already know what you are copying?
 

Users who are viewing this thread

Back
Top Bottom