By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,476 Members | 889 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,476 IT Pros & Developers. It's quick & easy.

How to rename a filename in a system folder with VBA code

P: n/a
Dear reader,

I have a table with two fields, the fields are FileNameOld and FileNameNew.

Now I am looking for VBA code to search in a system folder for the
FileNameOld and change the filename to the FileNameNew.

I am thankful for any help.
Kind regards,
Simon
Oct 8 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Simon wrote:
Dear reader,

I have a table with two fields, the fields are FileNameOld and
FileNameNew.

Now I am looking for VBA code to search in a system folder for the
FileNameOld and change the filename to the FileNameNew.

I am thankful for any help.
Kind regards,
Simon
Dir("path to file") will tell you if the file exists. It will return the file
name if it does or return a zero length string "" if it does not.

The Name command can be used to change the name once you determine that the file
does exist.

Name "full path to old file name" As "full path to new file name"
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Oct 8 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.