Read text file line by line

The VBA code below shows how you can read a text file line by line. The empty line is where you will add your code to process each line.


Dim strFilename As String: strFilename = "C:\temp\yourfile.txt"
Dim strTextLine As String
Dim iFile As Integer: iFile = FreeFile
Open strFilename For Input As #iFile
Do Until EOF(1)
    Line Input #1, strTextLine
    
Loop
Close #iFile
Code VBA menu read text file line by line