写错了Next的顺序
Sub Search()
Dim str1 as string
dim str2 as string
dim i as integer
dim temp as string
dim j as integer
dim compare as integer
str1=text1.text
str2="dgim"
for i = 1 to len(str1)
for j = 1 to len(str2)
compare = instr(1,mid(str1,i,1),Mid(str2,j,1),vbTextCompare)
if compare <> 0 then
temp = temp & mid(str1,i,1)
end if
next j
~~~
next i
~~~
text2.text=temp
end sub
Sub Search()
Dim str1 as string
dim str2 as string
dim i as integer
dim temp as string
dim j as integer
dim compare as integer
str1=text1.text
str2="dgim"
for i = 1 to len(str1)
for j = 1 to len(str2)
compare = instr(1,mid(str1,i,1),Mid(str2,j,1),vbTextCompare)
if compare <> 0 then
temp = temp & mid(str1,i,1)
end if
next i
next j
text2.text=temp
end sub