End
End Sub
Private Sub cmdFind_Click()
Dim StrCz As String, StrTh As String, I As Integer, J As Integer, K As Integer
StrCz = InputBox("你察携桐要查找什么?", "查找", "上海市"隐贺)
StrTh = InputBox("你要将查找到的字符替换成什么?", "替换", "南京市")
On Error Resume Next
I = 0
Do
DoEvents
Txtpape.SetFocus
Txtpaper.SelStart = InStr(IntKs + 1, Txtpaper, StrCz) - 1
If Err = 380 Then
MsgBox "查找完毕!", vbOKOnly, "查找完毕"
Exit Sub
End If
IntKs = Txtpaper.SelStart + Len(StrCz)
Txtpaper.SelLength = Len(StrCz)
I = I + 1
lblFinded = "已经找到" &I &"处"
K = MsgBox("找到第" &I &"处“" &StrCz &"”,是否替换?", vbYesNo, "找到第" &I &"处“" &StrCz &"”")
If K = 6 Then
Clipboard.Clear
Clipboard.SetText StrTh
Txtpaper.SelText = Clipboard.GetText
J=j+1
lblReplaced="您替换了" &J &"次!"
End If
Loop
End Sub
Private Sub Form_Load()
cmdExit.Caption = "退 出"
cmdFind.Caption = "查找替换"
Txtpaper = "上海市青少年计算机应用 *** 作竞赛是一项经上海市教委批准,由上海市青少年科技教育中心主办的加分竞赛活动?旨在培养青少年的软件 *** 作和应用能力,适应当今社会科技、信败坦息的飞速发展,激发青少年学生学习计算机的兴趣,早日成为二十一世纪的全能人才。"
End Sub
更多VB代码请关注我的博客:http://hi.baidu.com/zgmg/blog/item/1384db03008e9884d53f7c35.html
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)