Re: Daten aus TXT untereinander wieder geben.
28.06.2002 15:57:30
Deston
Sorry, beim nächstenmal kommt es sofort!
Sub Auslesen()
Dim arrFiles As Variant
Dim intCounter As Integer, intCol As Integer
Dim strPath As String, txt As String
strPath = Application.InputBox("Geben Sie den Pfad der TXT Dateien an:")
arrFiles = FileArray(strPath, "*.txt")
Close
For intCounter = 5 To UBound(arrFiles)
Cells(intCounter, 1) = arrFiles(intCounter)
Open strPath & arrFiles(intCounter) For Input As #1
intCol = 1
Do Until EOF(1)
Line Input #1, txt
intCol = intCol + 1
Cells(intCounter, intCol) = txt
Loop
Close
Next intCounter
End Sub
Function FileArray(strPath As String, strPattern As String)
Dim arrDateien()
Dim intCounter As Integer
Dim strDatei As String
If Right(strPath, 1) <> "\" Then strPath = strPath & "\"
strDatei = Dir(strPath & strPattern)
Do While strDatei <> ""
intCounter = intCounter + 1
ReDim Preserve arrDateien(1 To intCounter)
arrDateien(intCounter) = strDatei
strDatei = Dir()
Loop
If intCounter = 0 Then
ReDim arrDateien(1)
arrDateien(1) = False
End If
FileArray = arrDateien
End Function