SelectCurrentColor 方法

       

向前扩展所选内容,直至遇到另一种颜色的文字为止。

expression.SelectCurrentColor

expression   必需。该表达式返回一个 Selection 对象。

示例

本示例从文档的开头将所选内容向前扩展,直至遇到另一种颜色的第一个字符,然后显示选定部分中的字符数。

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