MatchWholeWord Property [Publisher 2003 VBA Language Reference]
Sets or returns a Boolean that represents whether the whole word will be matched in the search operation. Read/write. Boolean.
expression.MatchWholeWord
expression Required. An expression that returns a FindReplace object.
Remarks
The default value for MatchWholeWord is False.
Example
This example will select each occurrence of the word "fact" and apply bold formatting.
With ActiveDocument.Find
.Clear
.MatchWholeWord = True
.FindText = "fact"
.ReplaceScope = pbReplaceScopeNone
Do While .Execute = True
.FoundTextRange.Font.Bold = msoTrue
Loop
End With
This example follows the previous example except that whole words will not be matched. Therefore the word "fact" within the word "factory" or "factoid" will also have bold formatting applied.
With ActiveDocument.Find
.Clear
.MatchWholeWord = False
.FindText = "fact"
.ReplaceScope = pbReplaceScopeNone
Do While .Execute = True
.FoundTextRange.Font.Bold = msoTrue
Loop
End With
Applies to | FindReplace Object