Textdatei in Excel einlesen

Hallo
Ich möchte eine Textdatei, in der je 6 Zeilen zu einem Datensatz gehören, in Excel in 6 Spalten einlesen.
mit folgendem Code gehts nicht:
Set shFirstQtr = Workbooks(1).Worksheets(2)
Set qtQtrResults = shFirstQtr.QueryTables _
.Add(Connection:=„TEXT;C:\test.txt“, _
Destination:=shFirstQtr.Cells(1, 1))
With qtQtrResults
.TextFileParseType = xlFixedWidth
.TextFileFixedColumnWidths = Array(10, 15, 15, 15, 254, 15)
.TextFileColumnDataTypes = _
Array(xlDMYFormat, xlGeneralFormat, xlGeneralFormat, _ xlGeneralFormat, xlTextFormat, xlGeneralFormat)
.Refresh
End With

End Sub

Bis jetzt wandel ich in Word, Text in Tabelle um. Ist halt ein wenig umständlich.
MfG
Norbert

Das Programm liest Zeile für Zeile bis Dateiende und verteilt es auf mehrere Spalten
Bei einigen Zellen wird noch das Format eingestellt, vielleicht hilft Dir das weiter.
Gruß
G.F.
Sub Makro1()

Workbooks.Add
ActiveWindow.Zoom = 75
zeile = 0
a$ = „“
Jahr$ = „.2001“
Open „c:/datei.txt“ For Input As #1
Do While Not EOF(1) ’ Schleife bis Dateiende.
Zeichen1 = Input(1, #1) ’ Ein Zeichen lesen.
If Zeichen1 >= " " Then a$ = a$ + Zeichen1
If Zeichen1 „“ Then
b$ = Mid$(a$, 1, 5)
If b$ " " Then
spalte = 1
zeile = zeile + 1
b$ = Mid$(a$, 1, 5) & Jahr$ ’ Datum
Cells(zeile, spalte) = b$
Cells(zeile, spalte).NumberFormat = „d/ mmmm yyyy“
spalte = spalte + 1
Cells(zeile, spalte) = Mid$(a$, 7, 4) ’ WERT
spalte = spalte + 1
b$ = Mid$(a$, 1, 5) & Jahr ’ Datum
Cells(zeile, spalte) = b$
spalte = spalte + 1
Cells(zeile, spalte) = Trim(Mid$(a$, 18, 8))
spalte = spalte + 1
b$ = Mid$(a$, 27, 13) ’ Betrag
b$ = LTrim(b$)
Cells(zeile, spalte) = CDbl(b$)
spalte = spalte + 1
b$ = Mid$(a$, 40, 1) ’ S oder H
Cells(zeile, spalte) = b$
spalte = spalte + 1
Else
Cells(zeile, spalte).NumberFormat = „@“
Cells(zeile, spalte) = Trim(a$)
spalte = spalte + 1
End If
a$ = „“
End If
Loop
Close #1
End Sub

Danke Günther