ich habe folgendes Problem. Ich habe eine txt-Datei, die ich in Excel importieren möchte.
Folgenden Code habe ich bisher:
Sub txttoxls(ByVal File As String, ByVal zWkb As String)
Dim txt As String
Dim Buffer As String
Dim acLine As Long
Dim acCol As Long
acLine = 0
acRow = 1
txt = File
Open txt For Input As 1
While Not EOF(1)
Buffer = Input(1, #1)
If Buffer = ";" Then
acLine = acLine + 1
acRow = 1
ElseIf Buffer = "," Then
acRow = acRow + 1
Else
Application.Workbooks(zWkb).Sheets(1).Cells(acLine, acRow).Value = _
Application.Workbooks(zWkb).Sheets(1).Cells(acLine, acRow).Value & _
Buffer
'Application.Workbooks(zWkb).Sheets(1).Cells(1, 2).Value = "tesr"
End If
Wend
Close #1
ActiveWorkbook.Save
End Sub
Die umzuwandelnde Datei sieht folgendermaßen aus (und genau hier liegt das Problem):;Onlineshop,194160,,LIE15/155448,LIE15/155448,LIE15/155448,LIE15/155448,LIE15/155448
;per Fax,144253,,LIE15/155450
;Onlineshop,193246,,LIE15/155451,LIE15/155451
;per Fax,141250,,LIE15/155456
;per Fax,300114,,LIE15/155457
Bei dem Makro erhalte ich eine Laufzeitfehler in der "Else-Condition". Habt ihr Ideen wo der Fehler liegt?