Solved

Moving Files

Posted on 2003-10-29
5
177 Views
Last Modified: 2010-05-03
All I want To Do is move  a file from location Text1.Text to location of Text2.Text from a Command Button thanx in advance!!!
0
Comment
Question by:mattewjones
5 Comments
 
LVL 8

Expert Comment

by:ampapa
Comment Utility
Do you mean move the text from text1 to text2?
0
 
LVL 49

Expert Comment

by:Ryan Chong
Comment Utility
Try:

Name Replace$(Text1 & "\" & fileArr(i), "\\", "\") As Replace$(Text2 & "\" & newname, "\\", "\")
           
0
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 50 total points
Comment Utility
oops, should be simplified to:

Name Replace$(Text1, "\\", "\") As Replace$(Text2, "\\", "\")

of course, add the validation if necessary.
           
cheers
0
 

Author Comment

by:mattewjones
Comment Utility
spot on thanx!!!
0
 
LVL 11

Expert Comment

by:dbrckovi
Comment Utility
This is how i understood your question.

In VB, under Project, select references. Click 'Browse' and find a file scrrun.dll  (Should be in ...\System32 directory)
Click Open and OK.   Then use this code in you button.

For copiing:
------------------
Private Sub Command1_Click()

    Dim fso As New FileSystemObject
    fso.CopyFile Text1.Text, Text2.Text

End Sub


For moving:
------------------
Private Sub Command1_Click()

    Dim fso As New FileSystemObject
    fso.MoveFile Text1.Text, Text2.Text

End Sub

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now