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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename file, import it, then move it to another dir 1

Status
Not open for further replies.

brettatexplace

Technical User
Mar 8, 2002
60
CA
Need a little help with VBA.

I need to rename a file from x.lst to x.txt . I then have an import macro that works great with the x.txt file. After that I want to move the x.txt file into my "done" directory and rename it to y.txt. What would be the VBA code for this???

Can the rename and move be put into the macro? (how do I convert/export my macro into VBA code?) All pretty simple? Please help. Thanks in advance.
 
Hi
You can use Save As to save a macro as code. Regarding renaming files:
Take a look at the Dir function and at the Name oldpathname As newpathname instruction.
Hope This Helps, PH.

If this is right, thank PVH, if not, blame me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top