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

Renaming File Extensions from .log to .txt

Status
Not open for further replies.

thomsons

Programmer
Dec 16, 2002
19
0
0
GB
I'm currently writing a VBA Macro from within MS Access 2000 where I wish to rename all the files in a directory from having the file extension .log into .txt files prior to importing into an Access Database

I'm unsure as to whether or not this can be done - any assistance would be greatly appreciated

Cheers,
S.
 
Hi

In VBA Code

something like (not tested)

FileName = Dir (*.Log)
Do Until FileName = ""
rename filename as left(filename,len(filename)-3) & ".txt"
filename = Dir
next Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Cheers for that Ken - if you change the rename to just name then it works beautifully

name filename As Left(filename, Len(filename) - 3) & "txt"


Thanks,
S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top