option explicit
private sub cancelbutton_click()
okbutton_click
form1.text1.seltext = text2.text
end sub
private sub command1_click()
if fstring = "" then
fstring = text1.text
else
if text1.text <> fstring and text1.text <> "" then
fstring = text1.text
end if
end if
for startpos = 0 to len(form1.text1)
if check1.value = 1 then
foundpos = form1.text1.find(fstring, startpos, , 4)
else
foundpos = form1.text1.find(fstring, startpos)
end if
if foundpos <> -1 then
form1.text1.seltext = text2.text
end if
next startpos
end sub
private sub command2_click()
unload me
end sub
private sub form_load()
okbutton.enabled = false
cancelbutton.enabled = false
command1.enabled = false
end sub
private sub okbutton_click()
if fstring = "" then
fstring = text1.text
else
if text1.text <> fstring and text1.text <> "" then
fstring = text1.text
end if
end if
startpos = form1.text1.selstart + form1.text1.sellength
endpos = len(form1.text1)
if check1.value = 1 then
foundpos = form1.text1.find(fstring, startpos, endpos, 4)
else
foundpos = form1.text1.find(fstring, startpos, endpos)
end if
if foundpos <> -1 then
startpos = foundpos + 1
else
msgbox "find not " + chr(34) + fstring + chr(34)
end if
'gstring = fstring
end sub
private sub text1_change()
if text1.text <> "" then
okbutton.enabled = true
cancelbutton.enabled = true
command1.enabled = true
else
okbutton.enabled = false
cancelbutton.enabled = false
command1.enabled = false
end if
end sub