Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert XLS to TXT decimal sign problem 1

Status
Not open for further replies.

tinoni

IS-IT--Management
May 8, 2006
7
PT
Hi,
I'm using a macro to convert a *.XLS to *.TXT (Tab separator) file, but I've a (big) problem: the decimal sign allways changes from a comma (,) to a dot (.). I already try to change the regional settings but no good. This is driving me crazy!!!

Macro statement:
ActiveWorkbook.SaveAs Filename:="test.txt" _
, FileFormat:=xlText, CreateBackup:=False

Thanks for the help.
Rafael
 



Hi,

Short of finding a built-in work-around, consider

1. insert a new sheet

2. write a procedure to convert each numeric value to a string, replacing the separators.

3. save as with the new sheet active - will ONLY save that sheet

Skip,

[glasses] [red][/red]
[tongue]
 
In

Tools | Options | International

There is a check box that allows you to choose between using the Windows regional settings, or define the decimal separater for excel.

Perhaps you have that box unchecked?
 



I knew that an expert would post the REAL solution. ==> * :)

Skip,

[glasses] [red][/red]
[tongue]
 
Hi mintjulep,
I already tried to change that options but the result still the same. The oddest thing is: If I manually save as an TXT (tab separator)- file | save as, works fine, but if I use a macro, fails, change from a comma to a dot.

Rafael
 
Have you tried recording a macro when you SaveAs manually (when it 'works fine') and using the code produced in your macro?
 
yes, it's the code that I used:

ActiveWorkbook.SaveAs Filename:="test.txt" _
, FileFormat:=xlText, CreateBackup:=False
 
Have you exhausted all the arguments available to SaveAs; The 'Local' argument looks interesting.
 
Hi HughLerwill,
Thanks for your tip, it work perfectly.

Rafael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top