Table of contents
TOC
Collapse the table of content
Expand the table of content

FindReplace.MatchWholeWord Property (Publisher)

office 365 dev account|Last Updated: 8/24/2017
|
3 Contributors

Sets or returns a Boolean that represents whether the whole word will be matched in the search operation. Read/write. Boolean.

Syntax

expression. MatchWholeWord

_expression_A variable that represents a FindReplace object.

Return Value

Boolean

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 
© 2018 Microsoft