473,395 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

copy an Excel workbook from one drive to another drive

3
This may be so elementary that no one has ever had to ask it. How do I copy an Excel workbook that is on drive E to drive F using Visual Basic 6.0? I have tried several different ways without success. I don't get error messages, it just doesn't happen.

Thanks very much,

Turtle
Feb 19 '07 #1
4 2030
Killer42
8,435 Expert 8TB
This may be so elementary that no one has ever had to ask it. How do I copy an Excel workbook that is on drive E to drive F using Visual Basic 6.0? I have tried several different ways without success. I don't get error messages, it just doesn't happen.
If you just need to copy the XLS file, try the FileCopy statement.
Feb 20 '07 #2
turtle
3
Thanks for the quick response.

The first thing I tried was:

Dim SourceFile As String
Dim DestinationFile As String
SourceFile = "I:\ss1.xls"
DestinationFile = "A:\ss1.xls"
FileCopy (SourceFile, DestinationFile)

The error message for the last statement was "Expected =". I tried with the files dimensioned as Excel workbooks. I also tried several variations with an equal sign inserted in the last statement.


I also tried:

My.Computer.FileSystem.CopyFile("I:\ss1.xls","A:\" )

The error message again was "Expected =".

I am working in Visual Studio 6.0. Somehow I am not doing something right.

Again, thanks.

Turtle
Feb 20 '07 #3
Killer42
8,435 Expert 8TB
It's not the specific statements that are giving you trouble here, it's your general syntax. You only use parentheses like that when retrieving a value from a function, or specifying an element in an array. For example, this slight variation on your original code should work better...
Expand|Select|Wrap|Line Numbers
  1. Dim SourceFile As String
  2. Dim DestinationFile As String
  3. SourceFile = "I:\ss1.xls"
  4. DestinationFile = "A:\ss1.xls"
  5. FileCopy SourceFile, DestinationFile
(Also, note that it's a bit more readable if you place CODE tags around it when posting here, as I have done.)
Feb 20 '07 #4
turtle
3
It worked like a charm! Many many thanks.

Turtle
Feb 20 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Matthew Wieder | last post by:
I have the following requirements: Build a stand-alone C# application that asks the user to click in a cell in an Excel spreadsheet, and then displays the address of that cell in the C#...
0
by: eyal | last post by:
Hello, I want to open 2 workbook, , lets say workbook1 and workbook2 now I want to copy data from a sheet name "TEST" in workbook2 and paste the data to a sheet named "TEST" in workbook. now...
0
by: shan_chennai | last post by:
I have the followign requirement.. I have a worksheet Named 'Sales' in a excel Workbook named "WorkBook1". There is another workbook by Name "Workbook2" which has many worksheets. There is a...
0
by: Kay | last post by:
Hi all, I want to copy an entire row from a worksheet to another worksheet, when I set the excel app = visible and step thru the code I can actally see a row is appended to another worksheet,...
9
by: Doug Glancy | last post by:
I got the following code from Francesco Balena's site, for disposing of Com objects: Sub SetNothing(Of T)(ByRef obj As T) ' Dispose of the object if possible If obj IsNot Nothing AndAlso...
3
by: samj | last post by:
Looking at code examples, it would seem this is simple, but I can't figure it out. From an Access 2000 form command button, I want to copy all worksheets in an existing workbook to an existing...
22
by: robertgregson | last post by:
Using C#, .NET3.5, Visual Studio 2008 and WCF on Windows VISTA SP1, I have written a service, service host (as a C# console application) and a client. The service uses...
13
by: Peter | last post by:
VS2008 ans ASP.NET 3.5, Office 2003 What is the best way to run Excel Template from ASP.NET web page were the Excel is only installed on the client without any ActiveX? If so can someone point...
4
by: omono84 | last post by:
I know that this should be rather simple but i seem to be missing a step to get it to work. and have been unable to find a solution on the net. The aim is that I click on the open button to find...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.