【发布时间】:2011-03-31 13:09:22
【问题描述】:
您好,我下面的代码已经完美运行。我想不通的是如何计算通配符搜索找到匹配项的次数。谁能告诉我该怎么做?代码如下:
Sub findfunction()
If (findHL(activedocument.Content, "[aeiou]")) = True Then MsgBox "Highlight vowels Done", vbInformation + vbOKOnly, "Vowels Highlight Result"
If (findHL(activedocument.Range, "<wa*>")) = True Then MsgBox "Highlight words beginning with WA", vbInformation + vbOKOnly, "Prefix Find Result"
End Sub
Function findHL(r As Range, s As String) As Boolean
Options.DefaultHighlightColorIndex = wdRed
r.Find.Replacement.highlight = True
r.Find.Execute FindText:=s, MatchWildcards:=True, Wrap:=wdFindContinue, Format:=True, replace:=wdReplaceAll
findHL = True
End Function
任何帮助将不胜感激。谢谢大家!
【问题讨论】: