HighlightColorIndex Property

Microsoft Word Visual Basic

HighlightColorIndex Property

       

Returns or sets the highlight color for the specified range. Read/write WdColorIndex.

Applies to one of the following WdColorIndex constants.

    wdByAuthor    

    wdAuto

    wdNoHighlight

    wdBlack

    wdBlue

    wdBrightGreen

    wdDarkBlue

    wdDarkRed

    wdDarkYellow

    wdGray25

    wdGray50

    wdGreen

    wdPink

    wdRed

    wdTeal

    wdTurquoise

    wdViolet

    wdWhite

    wdYellow

expression.HighlightColorIndex

expression   Required. An expression that returns one of the objects in the Applies To list.

Remark

Setting this property to wdNoHighlight removes the highlight color (if any) from the specified range.

Example

This example removes highlight formatting from the selection.

Selection.Range.HighlightColorIndex = wdNoHighlight

This example applies yellow highlighting to each bookmark in the active document.

For Each abookmark In ActiveDocument.Bookmarks
    abookmark.Range.HighlightColorIndex = wdYellow
Next abookmark