Rename a text file with VBA or a macro in access

Posted on 2006-11-08
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?
Question by:niner
  • 2
  • 2
LVL 33

Accepted Solution

hongjun earned 50 total points
ID: 17899306
You can do this

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

Author Comment

ID: 17899373
How/where, in VBA?
LVL 33

Expert Comment

ID: 17899386
Yes. in VBA

Expert Comment

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

Best Regards,

Paulo Condeça.

Author Comment

ID: 17899445
Ah, I got it. Can this be extrapolated to like *.txt or does the first filename need to be explicit?

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Database tuning – How to start and what to tune. This question is frequently asked by many people, both online and offline. There is no hard and fast rule-of-thumb for performance tuning, however, before beginning the tuning process one should a…
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question