Sub
ExportTxt()
Dim
strDatei
As
String
Dim
strDate
As
String
Dim
flNr
As
Integer
Dim
rng
As
Range
flNr = FreeFile
strDatei = Application.GetSaveAsFilename(InitialFileName:=
"LODAS_"
& Range(
"a1"
) &
"_"
& Range(
"b1"
) &
".txt"
, _
fileFilter:=
"strText Files (*.txt), *.txt"
)
Open strDatei
For
Output
As
flNr
With
ActiveSheet
Print #flNr,
"[Allgemein]"
Print #flNr,
"Ziel="
Print #flNr,
"Version_LVE=5.0"
Print #flNr,
"Nr1="
& .Range(
"A1"
).Value
Print #flNr,
"Nr2="
& .Range(
"B1"
).Value
Print #flNr,
"[Bewegungsdaten]"
strDate = .Range(
"C1"
).Text
For
Each
rng
In
.Range(.Range(
"A2"
), .Range(
"A2"
).
End
(xlDown)).Rows
If
Not
IsEmpty(rng.Cells(1, 2))
Then
If
Not
Len(rng.Cells(1, 2).Value) = 0
Then
Print #flNr,
"1;"
& strDate &
";"
& Trim(rng.Cells(1, 2).Text) &
";"
& Trim(rng.Cells(1, 3).Text) &
";1;"
& Trim(rng.Cells(1, 1).Text) &
";02;;;'Imp. LVE 5.0'"
End
If
End
If
Next
End
With
Close #flNr
End
Sub