ich hoffe mir kann mir jemand helfen!
Ich möchte eine Tabelle als Textdatei exportieren und die Datebsätze an eine bestehende Textdatei anhängen.
Wie das exporitieren funktioniert habe ich schon im Archiv gefunden. Danke an ?? -> hab leider den Author nicht mitkopiert!!
Sub TXT_Export()
Dim iFile As Integer, iRow As Integer, iCol As Integer
Dim sFile As String, sTxt As String
sFile = Mid(ThisWorkbook.FullName, 1, Len(ThisWorkbook.FullName) - 3) & "txt"
iFile = FreeFile
Open sFile For Output As iFile
For iRow = Selection.Row To Selection.Rows.Count
For iCol = Selection.Column To Selection.Columns.Count
sTxt = sTxt & Cells(iRow, iCol).Value & vbTab
Next iCol
sTxt = Left(sTxt, Len(sTxt) - 1)
If iRow < Selection.Rows.Count Then
Print #iFile, sTxt
Else
Print #iFile, sTxt;
End If
sTxt = ""
Next iRow
Close iFile
End Sub