Solved

Compile Error in VB

Posted on 2004-08-24
4
437 Views
Last Modified: 2009-07-29
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
Comment
Question by:pratikshahse
4 Comments
 
LVL 18

Expert Comment

by:bobbit31
ID: 11885627
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
 
LVL 6

Expert Comment

by:bkthompson2112
ID: 11885640
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
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 11886865
and you don't need the quotes around the word false.  Its a boolean not a string.
0
 
LVL 23

Accepted Solution

by:
gecko_au2003 earned 25 total points
ID: 11905534
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
A short article about problems I had with the new location API and permissions in Marshmallow
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now