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

problems with "filesystem.filecopy".... 1

Status
Not open for further replies.

mgonzalez

Programmer
Aug 2, 2000
51
0
0
MX
Hello


I hope that someone coul help me... I am trying to use the
instruccion filesystem.filecopy like this:
Dim var1,origin,destiny as string
origin = "C:\files\123.jpg"
destiny = "C:\files\newfolder"
Var1 = filesystem.filecopy(origin,destiny)

But when a start the program this say "Expected Function or variable" and is stayed in filecopy method...I tried to resolve it setting instead variable the path...but is the same....Please someone could tell what could be the problem????or any alternative to do this??


Thanks
 
What filesystem?
FileCopy is a standalone statement.
FileCopy Statement
Copies a file.
Syntax
FileCopy source, destination
The FileCopy statement syntax has these named arguments:
Part Description
source Required. String expression that specifies the name of the file to be copied. The source may include directory or folder, and drive.
destination Required. String expression that specifies the target file name. The destination may include directory or folder, and drive.
Remarks
If you try to use the FileCopy statement on a currently open file, an error occurs.
 
Try this code. I have tested it and it was ok.
Good luck.

Dim fso As New FileSystemObject, fil1
Set fil1 = fso.GetFile("c:\files\testfile.txt")
fil1.Copy ("C:\files\newfolder\")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top