Error with currunc

S

SpeeD72

Hi.

I´ve made a simple macro to save 2 sheets do a txt tab separated. The
problem is that the numbers formated as "currency" (with a euro sign)
end up with a dollar sign in the resulting txt.

Does anyone knows why this is hapenning?

this is my code


Sheets("HOLDI").Select
ActiveWorkbook.SaveAs Filename:= _
ActiveWorkbook.Path & "\..\Dados_holdi.txt" _
, FileFormat:=xlText, CreateBackup:=False
Sheets("EMP").Select
ActiveWorkbook.SaveAs Filename:= _
ActiveWorkbook.Path & "\Dados_emp.txt" _
, FileFormat:=xlText, CreateBackup:=False

ActiveWindow.Close

Thnks a lot

SpeeD
 
G

Guest

Had the same problem myself - it's because it's an American package and
defaults to American formats (same problem with dates which are even more of
a headache!). Sorry, haven't found a solution but would love to hear of one
- hence tagging on to this thread.
 
S

SpeeD72

Hi.

It´s a really bad situation. It would save me a ton of time if we
could make this work...

Microsoft... is there anybody out there?

SpeeD
 
G

Guest

try this code. I modified one of my CSV wriote programs to put TAB instead
of Comma.


Sub WriteTAB()

Const Delimiter = chr(9)

Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const MyPath = "C:\temp\"
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0


Set fswrite = CreateObject("Scripting.FileSystemObject")

WriteFileName = "text.csv"


'open files
WritePathName = MyPath + WriteFileName
fswrite.CreateTextFile WritePathName
Set fwrite = fswrite.GetFile(WritePathName)
Set tswrite = fwrite.OpenAsTextStream(ForWriting, TristateUseDefault)

lastrow = Cells(Rows.Count, "A").End(xlUp).Row

For RowCount = 1 To lastrow
LastCol = Cells(RowCount, Columns.Count).End(xlToLeft).Column
For ColCount = 1 To LastCol
If ColCount = 1 Then
OutputLine = Cells(RowCount, ColCount)
Else
OutputLine = OutputLine & Delimiter & Cells(RowCount, ColCount)
End If
Next ColCount
tswrite.writeline OutputLine
Next RowCount

tswrite.Close

Exit Sub
End Sub
 

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

Top