ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error with currunc (https://www.excelbanter.com/excel-programming/401084-error-currunc.html)

SpeeD72[_2_]

Error with currunc
 
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


Smallweed

Error with currunc
 
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.

"SpeeD72" wrote:

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



SpeeD72[_2_]

Error with currunc
 
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


joel

Error with currunc
 
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






"SpeeD72" wrote:

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




All times are GMT +1. The time now is 01:18 PM.

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