In a Word 2007 macro that finds text using wildcards, how do I access the group match values?
For example, if I script a macro that searches for DATE: (<*>)^13, how would I find the value of the match group (<*>)?
Thank you,
Ben
Sub Search()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "DATE: (<*>)^13"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
End Sub
Doesn’t look like Word’s find feature can do this. However, if I use VBScript Regular Expressions, my script should be able to get match results via the return value of the vbscript.regexp object’s Execute method:
http://windowsdevcenter.com/pub/a/windows/excerpt/wdhks_1/index.html?page=4