Find Property Example

The following example searches forward through the document for the word "Microsoft." If the word is found, it's automatically selected.

With Selection.Find
    .Forward = True
    .ClearFormatting
    .MatchWholeWord = True
    .MatchCase = False
    .Wrap = wdFindContinue
    .Execute FindText:="Microsoft"
End With

This example inserts "Tip: " at the beginning of every paragraph formatted with the Heading 3 style in the active document. The Do…Loop statement is used to repeat a series of actions each time this style is found.

With ActiveDocument.Content.Find
    .ClearFormatting
    .Style = wdStyleHeading3
    Do While .Execute(FindText:="", Forward:=True, _
            Format:=True) = True
        With .Parent
            .StartOf Unit:=wdParagraph, Extend:=wdMove
            .InsertAfter "Tip: "
            .Move Unit:=wdParagraph, Count:=1
        End With
    Loop
End With