I am writing a code to open a text file through VBA, and match the value of mail_id taken from excel in the notepad. I saw few sample codes for this, and have modified it according to my data and requirement, but when counting the number of lines of the code, it is displaying error number 52. Also, please let me know how can I search for a string in notepad, and copy the text below it, if the string matches. Please find below code for reference:
 If mail_id <> " " Then
      Dim fso As Object
      Dim sfile As String
      Set fso = CreateObject("shell.application")
      sfile = "C:\My Documents\Textfile.txt"
      fso.Open (sfile)
       f = FreeFile
         Do While Not EOF(f)
            Ingline = Ingline + 1
            Line Input #f, strLine
            If InStr(1, strLine, mail_id, vbBinaryCompare) > 0 Then
            MsgBox Ingline, vbInformation
            bInfound = True
            End If
            Exit Do
          'End If
      Loop
      Close #f
      If Not blnFound Then
           MsgBox "Search string not found", vbInformation
       End If
Its showing the error at Do While Not EOF(f)