Highlight Property

Applies To

Find object, Replacement object.

Description

Find object: True if highlight formatting is included in the find criteria. Can return or be set to True, False, or wdUndefined. Read/write Long.

Note The wdUndefined value can be used with the Find object to ignore the state of highlight formatting in the selection or range that is searched.

Replacement object: True if highlight formatting is applied to the replacement text. Can return or be set to True, False, or wdUndefined. Read/write Long.

See Also

Execute method (Find object), Format property.

Example

This example finds all instances of highlighted text in the active document and removes the highlight formatting by setting the Highlight property of the Replacement object to False.

Set myRange = ActiveDocument.Range(Start:=0, End:=0)
With myRange.Find
    .ClearFormatting
    .Highlight = True
    With .Replacement
        .ClearFormatting
        .Highlight = False
    End With
    .Execute Replace:=wdReplaceAll, Forward:=True, FindText:="", _
        ReplaceWith:="", Format:=True
End With
This example applies highlight formatting to the next instance of bold text in the active document.

With Selection.Find
    .ClearFormatting
    .Font.Bold = True
    With .Replacement
        .ClearFormatting
        .Highlight = True
    End With
    .Execute Forward:=True, FindText:="", ReplaceWith:="", _
        Format:=True
End With