SelectCurrentColor Method

Applies To

Selection object.

Description

Extends the selection forward until text with a different color is encountered.

Syntax

expression.SelectCurrentColor

expression Required. An expression that returns a Selection object.

See Also

ColorIndex property, SelectCurrentFont method.

Example

This example extends the selection from the beginning of the document to the first character formatted with a different color and then displays the number of characters in the resulting selection.

Selection.HomeKey Unit:=wdStory, Extend:=wdMove
Selection.SelectCurrentColor
n = Len(Selection.Text)
MsgBox "Contiguous characters with the same color: " & n