Selection.SelectCurrentColor method (Word)
Extends the selection forward until text with a different color is encountered.
Syntax
expression. SelectCurrentColor
expression Required. A variable that represents a Selection object.
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
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for