Rename .txt file with macro

  • Thread starter Thread starter markjhunter
  • Start date Start date
M

markjhunter

Sorry about this rather simple question everyone but I have only jus
stated working with Excel!! :confused:

I need to rename an existing .txt file to a .xml file. The file wil
always be in the same directory on the pc, is this possible with cod
in a macro?
 
IF you want something simple try the shell command and then "rename
c:\filename.txt c:\filename.xml"
 
The following code allows you to change a filename, make sure and adjus
the
directory location / filename before running.

OldName = "C:\test.txt": NewName = "C:\test.xml"
Name OldName As NewNam
 
Hi Markjhunter,
I need to rename an existing .txt file to a .xml file. The file will
always be in the same directory on the pc, is this possible with code
in a macro??

Sure, it's the Name command:

Name OldFile, NewFile

Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk
 

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

Back
Top