TextRange.Find property (Publisher)

Returns a FindReplace object from the specified TextRange object. The FindReplace object is used to perform a text search and replace in the specified text range.

Syntax

expression.Find

expression A variable that represents a TextRange object.

Example

The following example sets an object variable to the FindReplace object of the text range of the first shape in the active document. A search operation is executed that applies bold formatting to every occurrence of the word Urgent in the text range.

Dim objFind as FindReplace 
Dim fFound as Boolean 
 
Set objFind = ActiveDocument.Pages(1) _ 
 .Shapes(1).TextFrame.TextRange.Find 
fFound = True 
 
With objFind 
 .Clear 
 .FindText = "Urgent" 
 Do While fFound = True 
 fFound = .Execute 
 If Not .FoundTextRange Is Nothing Then 
 .FoundTextRange.Font.Bold = True 
 End If 
 Loop 
End With

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.