• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 450
  • Last Modified:

Compile Error in VB

I have the following code which i want to use to copy a file from one location to another.


Set fsoobject = CreateObject("scripting.FileSystemObject")
fsoobject.copyfile ("c:\wachovia\new.txt", "c:\Wachovia\Backupfiles\" & combinestring, "False")

vb compiler is telling me that there is a "Compile Error , Expected: ="  

any ideas on what should be done to get this piece of code working.

Thank You

Pratik


0
pratikshahse
Asked:
pratikshahse
1 Solution
 
bobbit31Commented:
fsoobject.copyfile "c:\wachovia\new.txt", "c:\Wachovia\Backupfiles\" & combinestring, "False"

or

call fsoobject.copyfile ("c:\wachovia\new.txt", "c:\Wachovia\Backupfiles\" & combinestring, "False")

0
 
bkthompson2112Commented:
remove the parens from the copyfile line:
fsoobject.copyfile "c:\wachovia\new.txt", "c:\Wachovia\Backupfiles\" & combinestring, "False"

or use call
call fsoobject.copyfile("c:\wachovia\new.txt", "c:\Wachovia\Backupfiles\" & combinestring, "False")

bkt
0
 
Carl TawnSystems and Integration DeveloperCommented:
and you don't need the quotes around the word false.  Its a boolean not a string.
0
 
gecko_au2003Commented:
here just do this :


Set fsoobject = CreateObject("scripting.FileSystemObject")
x = fsoobject.copyfile ("c:\wachovia\new.txt", "c:\Wachovia\Backupfiles\" & combinestring, "False")

I tried and tested it with the following code because I dont have them directorys:

Set fsoobject = CreateObject("scripting.FileSystemObject")
x = fsoobject.copyfile("c:\new.txt", "D:\new.txt" & combinestring, "False")

and that worked for me. I had the code inside of a command button. I dont know if that is any help though lol.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now