noch eine Variante
21.03.2009 13:30:59
Tino
Hallo,
habe Dir noch eine Variante aufgebaut, vielleicht ist diese sogar etwas schneller.
Sub TextFileLesen()
Dim strFile As String, sInhalt As String
Dim myAr1, myAr2()
Dim A As Long
Dim iCalc As Integer
strFile = Application.GetOpenFilename("All TextFile (*.txt), *.txt")
If Dir$(strFile, vbNormal) <> "" Then
With Application
iCalc = .Calculation
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
Range("A15", Cells(Rows.Count, 2)).Value = ""
F = FreeFile
Open strFile For Binary As #F
sInhalt = Space$(LOF(F))
Get #F, , sInhalt
Close #F
myAr1 = Split(sInhalt, vbNewLine)
Redim myAr2(Ubound(myAr1), 1)
On Error Resume Next
For A = Lbound(myAr1) To Ubound(myAr1)
myAr2(A, 0) = Split(myAr1(A), vbTab)(0)
myAr2(A, 1) = Split(myAr1(A), vbTab)(1)
Next A
On Error GoTo 0
Range("A15").Resize(Ubound(myAr2, 1) + 1, 2) = myAr2
.Calculation = iCalc
.ScreenUpdating = False
.EnableEvents = False
End With 'Application
End If
End Sub
Gruß Tino