Private Sub mnuReplace_Click()
Static sSearch As String
Static sReplace As String
Dim nWhere As Long
Dim nReply As VbMsgBoxResult
sSearch = InputBox$("Find what", , sSearch)
If sSearch = "" Then Exit Sub
sReplace = InputBox$("Replace with", , sReplace)
If StrPtr(sReplace) = 0 Then Exit Sub ' if user chose 'Cancel'
nWhere = InStr(1, Text1.Text, sSearch)
Do While nWhere
Text1.SelStart = nWhere - 1
Text1.SelLength = Len(sSearch)
nReply = MsgBox("Replace?", vbQuestion + vbYesNoCancel)
Select Case nReply
Case vbYes
Text1.SelText = sReplace
Case vbNo
' pass
Case vbCancel
Exit Do
End Select
nWhere = InStr(nWhere + 1, Text1.Text, sSearch)
Loop
End Sub