ich möchte noch mal die Frage wiederholen, ob jemand weiss, wie es dazu kommt, dass in einer Textdatei, geschrieben mit VBA Print, zwei CR und dann ein LF auftauchen.
mit folgender Sequenz wird die Datei erzeugt:
strPath = Worksheets("Konstanten").Cells(8, 4).Value 'Speicherpfad eintragen
strDateiname = "BARVPositionen.csv" 'Dateinamen mit Dateiendung eintragen
Anf = Chr(34)
Set BarP = Worksheets("BARVPositionen")
lngZeile = BarP.Range("A" & Rows.Count).End(xlUp).Row
Open strPath & strDateiname For Output As #1
Print #1, Anf & "Kette" & Anf & ";" & Anf & "Menge_Text" & Anf & ";" & _
Anf & "Bezeichnung" & Anf & ";" & Anf & "Preiseinheit" & Anf & ";" & _
Anf & "EPreis" & Anf & ";" & Anf & "Prozent" & Anf & ";" & _
Anf & "GPreis" & Anf & ";" & Anf & "ArtikelNr" & Anf
For I = 1 To lngZeile
If IsNumeric(BarP.Cells(I, 1).Value) Then
If BarP.Cells(I, 3).Value = "°" Then
PreisE = "0"
Else
PreisE = BarP.Cells(I, 3).Value
End If
GPreis = Format(BarP.Cells(I, 6).Value, "#,###.00")
Else
PreisE = ""
GPreis = ""
End If
Print #1, I & ";" & Anf & BarP.Cells(I, 1).Value & Anf & ";" & _
Anf & Semikolon(BarP.Cells(I, 2).Value) & Anf & ";" & _
Anf & PreisE & Anf & ";" & Format(BarP.Cells(I, 4).Value, "#,###.00") & ";" & _
Format(BarP.Cells(I, 5).Value, "###") & ";" & GPreis & ";" & _
Anf & BarP.Cells(I, 7).Value & Anf
DoEvents
Application.StatusBar = "Positionen CSV Datensatz " & I & " von " & lngZeile
Next I
Close #1
Zur Illustration ein Bild der Datei:
https://www.herber.de/bbs/user/120170.jpg
Für eine Antwort bedanke ich mich recht herzlich.
Mit freundlichen Grüßen
Albrecht