Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Compile Error in VB

Posted on 2004-08-24
4
440 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
A short article about problems I had with the new location API and permissions in Marshmallow
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

856 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