FileCopy Probelm

J

jutlaux

I am trying to copy a file from a network location to a local drive via the
below code, but ever time I go to run the macro I get a "Path not found
error" what am I doing wrong?
sub CopyOTFile
strFileSource = "N:\shared\ENGINEER\ELECTRIC\OT.xls"
strFileDestination = "C:\"

FileCopy strFileSource, strFileDestination
end sub
 
A

Allllen

In the source you specified the source filename. So in the destination you
need to specify the new filename. You can't just overwrite the C:\.

try
strFileDestination = "C:\OT.xls"
 
J

jutlaux

Perfrect. I figured that since the file didn't exist in the first place it
would not matter, but I was wrong. Thanks for the help.
 

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