File Copy Error

J

Jay

I have copied this file from office excel help and ran it with error message
as follows. Run time error: '53' File Not Found
My deault folder address is My Documents and SRCFILE is under this directory.
Thank you for your advices .

Sub FileCopyTest()
Dim SourceFile, DestinationFile
SourceFile = "SRCFILE" ' Define source file name.
DestinationFile = "DESTFILE" ' Define target file name.
FileCopy SourceFile, DestinationFile ' Copy source to target
End Sub
 
R

Rowan Drummond

Try adding the file extensions:

Sub Cpy()
Dim SourceFile As String
Dim DestinationFile As String
SourceFile = "SRCFILE.xls" ' Define source file name.
DestinationFile = "DESTFILE.xls" ' Define target file name.
FileCopy SourceFile, DestinationFile ' Copy source to target.
End Sub

Hope this helps
Rowan
 

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