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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Foxpro errors 4 51
Coldusion - DATA insert syntax problem 12 62
T-SQL: Please describe what a page split is 5 38
Estimating my database size 7 21
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
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…

730 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