rename files in folder.

  • Thread starter turks67 via AccessMonster.com
  • Start date
T

turks67 via AccessMonster.com

Is there a way to rename all files in a folder with *.tpt to *.txt from a
command button in access?
 
A

Allen Browne

turks67 via AccessMonster.com said:
Is there a way to rename all files in a folder with *.tpt to *.txt from
a command button in access?


See help on the Name statement (in the VBA window.)
 
D

DStegon

turks67 said:
Is there a way to rename all files in a folder with *.tpt to *.txt from a
command button in access?


Use Dir to step through the folder you have selected.

Put this kind of code into the click event of the command button

Dim strFolder As String
Dim strCurrentFile As String

strfolder="C:\blah" '(You can always have the command button bring up the
open file dialog to choose the folder)
strCurrentFile = Dir(strFolder & \*.tpt")
Do Until strCurrentFile = ""
srtCurrentFile= Left(strCurrentFile, Len(strCurrentFile) - 3) &
"txt"
strCurrentFile = Dir '(Move you to the next file in the dir that
has .tpt
Loop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top