Public po As Long
Function find(key As String, Text1 As TextBox)
s = Text1.Text
t = key
Indexs = InStr(po, s, t)
If Indexs > 0 Then
With Text1
.SelStart = Indexs - 1
.SelLength = Len(t)
.SetFocus
End With
po = Indexs + 1
Else
MsgBox "没有找到你寻求的串"
po = 1
End If
End Function
Private Sub Command1_Click()
t = find("an", Text1)
End Sub