Wrox Programmer Forums
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 22nd, 2007, 11:54 PM
Registered User
Join Date: Sep 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help with a copy code

I am writing a code to copy files to a new location and the way I have it set up is to browse t the source location and have that pasted into textbox1. Then use the folder browser to specify a new location and have that pasted into textbox2.
I would like to have a button that will then copy that the file specified to the location specified.

My issue is that I am not sure how to do this using the FileSystemObject. So far I have:

        Dim fso

        fso = CreateObject("File.Copy")

but I am not sure if i am going the right direction or not.
I'm not sure how to make the copy command read the file that is shown in textbox1 and copy it into the location in textbox2.

Any help would be greatly appreciated as I have a dead line for this that is coming up very quickly.

Thank you again,

Old September 23rd, 2007, 03:04 AM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Hi Jimmie,

If you're using Visual Basic 2005, you shouldn't use the FileSystemObject. Instead, look at classes like System.IO.File, System.IO.Directory etc.


You'll find convenient methods like CreateDirectory, Move, Delete and so on that allow you to work with files and folders.

Hope this helps,


Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004

Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to copy a record from one table to another. lryckman Access VBA 7 July 29th, 2017 12:49 PM
Speed up code - looping and copy / paste vba_user Excel VBA 6 March 23rd, 2011 05:27 PM
Copy DataSet prasanta2expert ASP.NET 1.0 and 1.1 Professional 1 January 22nd, 2007 09:30 AM
MS Access, VBA code to copy recordset Ivan Classic ASP Databases 1 November 1st, 2003 05:52 PM
code to copy a query recordset to a file Ivan Access VBA 9 October 31st, 2003 06:50 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.