Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Compile Error in VB

Posted on 2004-08-24
4
Medium Priority
?
447 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
[X]
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
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 75 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

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.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Simple Linear Regression

609 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