Hi, I can't for the life of me figure out the code for this. I want to find the word 'hello'. If 'hello' appears more than once, I want it to find the next 'hello', and so on. I've looked at numerous snippits of code but all this seltext, selposition, sellength stuff has made me goggley eyed.

I've attached my code below, in the hope someone can help. When the first 'hello' is found, it should move on to find the next one.

Thanks for any help!

Private Sub Command1_Click()
Dim intStart As Integer
Dim lenSelected, posSelected As Long
intStart = InStr(1, Text1.Text, "hello")

Text1.SetFocus
Text1.SelStart = intStart - 1
Text1.SelLength = Len("hello")

If Len(Text1.SelText) <> 0 Then
Text1.SetFocus
posSelected = InStr(1, Text1, Text1.SelText)
lenSelected = Len(Text1.SelText)
Text1.SelStart = Len(Text1)
Text1.SelStart = posSelected - 1
Text1.SelLength = lenSelected
End If
End Sub