Save a workbook using FileFormat in .txt but with data in csv for

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
I have a workbook with data in rows and columns and I want to save it as a
csv text file but with a .txt extension and not a .csv extension. This .txt
file is then read by another programm.
If I save it with the Excel available .txt extensions, the txt file produced
is always a tab file.
The only code that produces the format I am looking for is:
ActiveWorkbook.SaveAs filename:=Range("A3").Value, FileFormat:=xlCSV,
CreateBackup:=False
ChDir "C:\Documents and Settings\Administrador\Escritorio"
but the file produced is with a .csv extension and what I want is a .txt
I really need to produce it direct and not have to use the Office rename
function.
Any ideas? Thks.
 
Yves,

If your Range("A3") ends in ".txt" or you change the line saving to;

ActiveWorkbook.SaveAs filename:=Range("A3").Value & ".txt",
FileFormat:=xlCSV, CreateBackup:=False

That wil force the filename to finish .txt not .csv

Regards,

Chris.
 
Back
Top