View Single Post
  #2 (permalink)  
Old December 19th, 2005, 11:18 AM
shattered shattered is offline
Authorized User
 
Join Date: Oct 2004
Location: , , .
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to shattered Send a message via Yahoo to shattered
Default

Sub TestData3()
    sPath = "C:\TestData\" ' Directory containing files
    sSplit = "|" ' Delimiter character
    sFileName = Dir(sPath)
    Do Until Len(sFileName) = 0
        If (sFileName <> ".") And (sFileName <> "..") Then
            iRow = GetNextRow("Sheet1")
            lFNum = FreeFile
            Open (sPath & sFileName) For Input As lFNum
            Do While Not EOF(lFNum)
                Line Input #lFNum, sInput
                vaFields = Split(sInput, sSplit)
                For i = 0 To UBound(vaFields)
                    Sheet1.Cells(iRow, i + 1).Value = vaFields(i)
                Next i
                iRow = iRow + 1
            Loop
            Close lFNum
        End If
        sFileName = Dir()
    Loop
End Sub

should do?

Reply With Quote