ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Rename .txt file with macro (https://www.excelbanter.com/excel-programming/315552-rename-txt-file-macro.html)

markjhunter

Rename .txt file with macro
 

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?

--
markjhunte
-----------------------------------------------------------------------
markjhunter's Profile: http://www.excelforum.com/member.php...fo&userid=1598
View this thread: http://www.excelforum.com/showthread.php?threadid=27456


HotRod

Rename .txt file with macro
 
IF you want something simple try the shell command and then "rename
c:\filename.txt c:\filename.xml"


"markjhunter" wrote in message
...

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

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??


--
markjhunter
------------------------------------------------------------------------
markjhunter's Profile:
http://www.excelforum.com/member.php...o&userid=15988
View this thread: http://www.excelforum.com/showthread...hreadid=274563




crispbd[_14_]

Rename .txt file with macro
 

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

--
crispb
-----------------------------------------------------------------------
crispbd's Profile: http://www.excelforum.com/member.php...fo&userid=1088
View this thread: http://www.excelforum.com/showthread.php?threadid=27456


Stephen Bullen[_4_]

Rename .txt file with macro
 
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




All times are GMT +1. The time now is 05:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com