ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   File Copy Error (https://www.excelbanter.com/excel-programming/343609-file-copy-error.html)

Jay

File Copy Error
 
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

Rowan Drummond[_3_]

File Copy Error
 
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

Jay wrote:
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



All times are GMT +1. The time now is 12:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com