Create CSV as TXT file

JazzSP8

Well-known Member
Joined
Sep 30, 2005
Messages
1,227
Office Version
  1. 2013
  2. 2010
Platform
  1. Windows
Hey All

I'm trying to use VBA in Excel 2003 to export a file as a CSV but with a TXT file extension.

So after some messing about I came to the conclusion that the best idea would be to create the CSV file as I normally would do and then simply rename the ".csv" as ".txt" which I can do no problem in DOS but I'd like to finish the job properly in the Macro.

Only problem being I don't have a clue how to do that from within VBA :(

Ideally if someone could point me in the right direction of the VBA equivalent of the DOS
Code:
ren *.csv *.txt
that would be great :)

Thanks in advance for any help that can be provided.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
You are looking for the Name statement ie:

Code:
Name Fullname&Path As NewFullName&Path

'eg:

Name "C:\SomeFolder\myTextFile.csv" As "C:\SomeFolder\myTextFile.txt"

EDIT: If you have more than one file, you need to loop thru the files doing each one individually.
 
Upvote 0
Ha! - So simple when you put it like that Richard!

I'd got NO idea that 'Name' existed LOL

Thanks a lot for the quick reply :)
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,394
Members
448,957
Latest member
Hat4Life

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top