Dezimaltrennzeichen
18.02.2009 22:51:00
Horst
wie kann ich bei folgender VBA-Prozedur angeben, dass unabhängig von der jeweiligen Systemeinstellung die Beträge in den erstellten .txt Dateien mit einen Punkt statt einem Komma als Dezimaltrennzeichen separiert werden sollen?
'Textdateien
strSep = vbTab
strFile = strPath & "Alpha.xls"
Set objWB = Workbooks.Open(strFile)
With objWB.Sheets("Beta")
lngLastCol = .Columns("Z").Column
lngRow = Application.Match(CLng(Date), .Columns("AA"))
arrVal = .Range(.Cells(1, 1), .Cells(lngRow, lngLastCol))
strTxtFile = strPath & "train.txt"
Open strTxtFile For Output As #1
For lngN = 1 To lngRow
strTmp = ""
For lngM = 1 To lngLastCol
strTmp = strTmp & arrVal(lngN, lngM) & strSep
Next
strTmp = Left(strTmp, Len(strTmp) - Len(strSep))
Print #1, strTmp
Next
Close #1
arrVal = .Range(.Cells(lngRow + 1, 1), .Cells(lngRow + 1, lngLastCol))
strTmp = ""
For lngM = 1 To lngLastCol
strTmp = strTmp & arrVal(1, lngM) & strSep
Next
strTmp = Left(strTmp, Len(strTmp) - Len(strSep))
strTxtFile = strPath & "test.txt"
Open strTxtFile For Output As #1
Print #1, strTmp
Close #1
End With
objWB.Close False
Gruß, Horst