Word VBA通​​配符搜索匹配

如何在范围内提取通配符搜索的查找结果?
dim r as range
set r = activedocument.range

Do While r.Find.Execute(findtext:="<*>", MatchWildcards:=True) = True
     Msgbox <Show the matching word it found here>
     if **<the word it matched>** = "Stop" then do something here
Loop 
上面的代码使用范围来通过使用&lt; *>作为通配符模式来查找范围中的任何整个单词。但是我怎样才能得到它找到的当前匹配/单词?     
已邀请:
Sub test()
Dim r As Range
Set r = ActiveDocument.Range
r.Select

With Selection.Find
    .ClearFormatting
    .Text = "<*>"
    .Forward = True
    .Wrap = wdFindStop
    .MatchWildcards = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
End With

Do While Selection.Find.Execute
     If Selection.Text = "stop" Then MsgBox "wohoo"
Loop
End Sub
编辑:我不太熟悉单词对象模型。
Find
方法适用于
Range
,但我不知道,如何找到它能找到的文本。运行宏后,上面的代码被修改,以查看生成的输出。 希望有所帮助。     

要回复问题请先登录注册