Why do you need to use the FSO? Try this:
VB Code:
Private Sub FindTextInFile(sStringToFind As String, sFileToLookIn As String)
Dim arrLinesArray() As String
Dim i As Long
Dim bIsItThere As Boolean
'read file into array of lines
Open sFileToLookIn For Binary As #1
arrLinesArray = Split(Input(LOF(1), #1), vbCrLf)
Close #1
'search array line by line for text
bIsItThere = False
For i = LBound(arrLinesArray) To UBound(arrLinesArray)
If InStr(arrLinesArray(i), sStringToFind) > 0 Then
bIsItThere = True 'found it
Exit For
End If
Next
'let them know whats going on
If bIsItThere = True Then
MsgBox "The string " & sStringToFind & " was found on line: " & i & " in " & UCase(sFileToLookIn)
Else
MsgBox "The string " & sStringToFind & " was not found in " & UCase(sFileToLookIn)
End If
End Sub
Private Sub Command1_Click()
Call FindTextInFile("StringToFind", "c:\FileToFindItIn.txt")
End Sub