Reading Text Files One Row at a Time : Text File « File Path « VBA / Excel / Access / Word






Reading Text Files One Row at a Time

 
Sub Import10()
    ThisFile = "C\sales.txt"
    Open ThisFile For Input As #1
    For i = 1 To 10
        Line Input #1, Data
        Cells(i, 1).Value = Data
    Next i
    Close #1
End Sub

 








Related examples in the same category

1.Create and Save Text file
2.Save Date and Time information to a text file
3.Filtering a text file
4.Read a text file, skipping the Total lines
5.Read a text file, adding the amounts
6.Use a Do...While loop to keep reading records until you've reached the end of the file:
7.Writing Text Files