本宏能够实现依次查找ori()中的文本,并替换为对应的rep()中的文本
Ori = Array("a","b","c")
Rep = Array("a","b","c")
For i = 0 To UBound(Ori)
With Selection.find
.Text = Ori(i)
.Replacement.Text = Rep(i)
.Forward = True
.Wrap = wdFindContinue
.Format = False '不查找格式
.MatchCase = False '不区分大小写
.MatchWholeWord = False '不采用全字匹配
.MatchByte = False '不区分全半角
.MatchWildcards = False '不使用通配符
.MatchSoundsLike = False '不查找同音
.MatchAllWordForms = False '不查找单词的所有形式
End With
本宏能够持续查找全文中的特定字符,并统计数量
i = 1
Do
With Selection.find
.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
.Execute (Text = "在此输入需要查找的内容")
End With
If Selection.find.Found Then
i = i + 1
Else: Msgbox("在此输入需要查找的内容共有" & i & "个")
End If
Loop