Find Object

Multiple objects
Multiple objects

Represents the criteria for a find operation. The properties and methods of the Find object correspond to the options in the Find and Replace dialog box.

Using the Find Object

Use the Find property to return a Find object. The following example finds and selects the next occurrence of the word "hi."

With Selection.Find
    .Text = "hi"
    .Execute Forward:=True
End With

The following example finds all occurrences of the word "hi" in the active document and replaces the word with "hello."

Set myRange = ActiveDocument.Content
myRange.Find.Execute FindText:="hi", ReplaceWith:="hello", _


If you've gotten to the Find object from the Selection object, the selection is changed when text matching the find criteria is found. The following example selects the next occurrence of the word "blue."

Selection.Find.Execute FindText:="blue", Forward:=True

If you've gotten to the Find object from the Range object, the selection isn't changed when text matching the find criteria is found, but the Range object is redefined. The following example locates the first occurrence of the word "blue" in the active document. If "blue" is found in the document, myRange is redefined and bold formatting is applied to "blue."

Set myRange = ActiveDocument.Content
myRange.Find.Execute FindText:="blue", Forward:=True
If myRange.Find.Found = True Then myRange.Bold = True

Properties | Application Property | CorrectHangulEndings Property | Creator Property | Font Property | Format Property | Forward Property | Found Property | Frame Property | Highlight Property | LanguageID Property | LanguageIDFarEast Property | LanguageIDOther Property | MatchAlefHamza Property | MatchAllWordForms Property | MatchByte Property | MatchCase Property | MatchControl Property | MatchDiacritics Property | MatchFuzzy Property | MatchKashida Property | MatchSoundsLike Property | MatchWholeWord Property | MatchWildcards Property | NoProofing Property | ParagraphFormat Property | Parent Property | Replacement Property | Style Property | Text Property | Wrap Property

Methods | ClearAllFuzzyOptions Method | ClearFormatting Method | Execute Method | SetAllFuzzyOptions Method

Parent Objects | Range Object | Selection Object

Child Objects | Font Object | Frame Object | ParagraphFormat Object | Replacement Object

See Also | Finding and Replacing Text or Formatting | Replacement Object