?
Solved

Compile Error in VB

Posted on 2004-08-24
4
Medium Priority
?
445 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?
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
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 …
Simple Linear Regression
Suggested Courses

752 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