To read file "line-by-line" you have to either use loop and check while you didn't reach EOF
or read entire text into string variable (this is already an overhead) then load array and then loop through array:
Code:
'method 1 (better by far)
Dim strLine$
Open somefile For Input As #1
Do While Not EOF(1)
Line Input #1, strLine
If InStr(1, UCase(strLine), "DEF") > 0 Then
'do something
End If
Loop
Close #1
'method 2 (will also work but isn't necessary best approach)
Dim strText$, arLines() As String, i%
Open somefile For Input As #1
strText = Input(LOF(1), #1)
arLines = Split(strText, vbNewLine)
strText = ""
For i = 0 To UBound(arLines)
strLine = arLines(i)
If InStr(1, UCase(strLine), "DEF") > 0 Then
'do something
End If
Next i
Close #1