itshibu 0 Newbie Poster

Dear Friends,

I would like to search a word or phrase in microsoft documents. I want to search text portion only. f possible line by line. so i can exit the reading while I find that word.

I tried with

OpenFileDialog1.ShowDialog()

        Dim ioFile As New StreamReader(OpenFileDialog1.FileName)
        Dim ioLine As String ' Going to hold one line at a time
        Dim ioLines As String ' Going to hold whole file
        ioLine = ioFile.ReadLine
        ioLines = ioLine
        While Not ioLine = ""
            ioLine = ioFile.ReadLine
            ioLines = ioLines & vbCrLf & ioLine
        End While
        TextBox1.Text = ioLines

But unfortunately some files are not reading properly.


pls help