Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically moving files

Status
Not open for further replies.

TomBarrand

Programmer
Aug 9, 2000
162
GB
I am currently using the code below to move file1 from one location to another location. The txt file is hard coded (file1.txt). I want it to be dynamic. fn is holding the name of each txt file. How do I change file1.txt to use the dynamic file stored in fn?

Sub ManipFiles
Dim fso, f1, fn
Set fso = CreateObject("Scripting.FileSystemObject")
fn = ework.Text1
Set f1 = fso.GetFile("c:\DPS Orders\New\file1.txt")
f1.Move ("c:\DPS Orders\In Progress\file1.txt")
End Sub

Thanks,

Tom
 
Set f1 = fso.GetFile("c:\DPS Orders\New\" & fn)

AND

f1.Move ("c:\DPS Orders\In Progress\" & fn)

:)
Paul Prewett
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top