I'm using the code below to find text within a text box then higlite the text..now the problem with this is, it will only fidn the first instance of the word then it will quit..im tryign to modify this code so i can add a function that will allow it to "find next" yet i have tried so many ways..

im not exactly sure what the coding is that i have to put in, but i know what i need etc

im thinking i need a way to starty the search at the point of where teh cursor is locatred...so therefore after the first word is located, the cursor will signify the start of the next search, and so on..except there seems to eb a problem while tryign this... please give it a shot if u think you can figure it out..

thanks alot

-joe

(put the code in a module) use the eg like this

EXAMPLE--searchHighlight(text1,"search")


Public Function searchHighlight(srchTextBox As textBox, srchString As String)


On Error resume Next
Dim A As Integer
Call srchTextBox.SetFocus
SendKeys ("^{HOME}")
A = 1


Do Until A = Len(srchTextBox.text)
'if word was found...


If Mid(UCase$(srchTextBox.text), A, Len(srchString)) = UCase$(srchString) Then
'highlight the word


For A = 1 To Len(srchString)
SendKeys ("+{RIGHT}")
Next A

Exit Do
End If

'if word isnt found or a return is found, dont do anything


If Mid(srchTextBox.text, A, 1) = Chr$(13) Then
Else
'go to next line
SendKeys ("{RIGHT}")
End If

A = A + 1
If A > Len(srchTextBox.text) Then Exit Do
Loop

End Function

?