We help IT Professionals succeed at work.

Rename a text file with VBA or a macro in access

niner
niner asked
on
Medium Priority
1,355 Views
Last Modified: 2012-06-27
How can I use MS Access to rename a file in another folder?

I have a file...  c:\test\file.txt
I want to use Access to rename it (like the ren function in DOS) to c:\test\NEW.txt

How can I do this? Can I do this? Will Britney ever find love again?
Comment
Watch Question

Commented:
You can do this


FileCopy C:\test\file.txt, C:\test\NEW.txt
Kill C:\test\file.txt

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
How/where, in VBA?

Commented:
Yes. in VBA

Commented:
That's pure VBSCRIPT, you can do as HonJun says .



Best Regards,

Paulo Condeça.

Author

Commented:
Ah, I got it. Can this be extrapolated to like *.txt or does the first filename need to be explicit?
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.