Gruppe
Extern
Problem
Wenn die Arbeitsmappe manuell gespeichert wird, fügt Excel Anführungszeichen hinzu. Dieses Problem soll umgangen werden.
StandardModule: Modul1
Sub Export()
Dim rng As Range
Dim iFile As Integer, iRow As Integer, iCol As Integer
Dim sFile As String, sTxt As String
Set rng = Range("A1").CurrentRegion
sFile = Application.Path & "\testtext.txt"
iFile = FreeFile
Open sFile For Output As iFile
For iRow = 1 To rng.Rows.Count
For iCol = 1 To rng.Columns.Count
sTxt = sTxt & Cells(iRow, iCol).Value & vbTab
Next iCol
sTxt = Left(sTxt, Len(sTxt) - 1)
Print #iFile, sTxt
sTxt = ""
Next iRow
Close iFile
Workbooks.OpenText _
Filename:=sFile, _
DataType:=xlDelimited, _
tab:=True, _
semicolon:=False, _
comma:=False, _
Space:=False, _
other:=False
MsgBox "Weiter"
ActiveWorkbook.Close savechanges:=False
Kill sFile
End Sub