StartIsActive 属性 (Word)Selection.StartIsActive property (Word)

如此 如果所选内容的开始部分处于活动。True if the beginning of the selection is active. 读/写 BooleanRead/write Boolean.


expressionexpression. StartIsActive

_表达式_一个返回**Selection** 对象的表达式。expression An expression that returns a Selection object.


如果所选内容没有折叠为一个插入点,开头或所选内容的末尾是活动的。If the selection is not collapsed to an insertion point, either the beginning or the end of the selection is active. 当您调用以下方法时, 所选内容的活动端将移动: EndKeyExtend (with 字符参数)、 HomeKeyMoveDownMoveLeftMoveRight 和**MoveUp**。The active end of the selection moves when you call the following methods: EndKey, Extend (with the Characters argument), HomeKey, MoveDown, MoveLeft, MoveRight, and MoveUp.

此属性等效于将**Flags** 属性与wdSelStartActive常量一起使用。This property is equivalent to using the Flags property with the wdSelStartActive constant. 但是,使用 Flags 属性需要二元运算,这比使用 StartIsActive 属性更复杂。However, using the Flags property requires binary operations, which are more complicated than using the StartIsActive property.


本示例将当前所选内容扩展到接下来的两个单词。This example extends the current selection through the next two words. 若要确保在扩展过程中, 当前选定的任何文本保持选中状态, 请先将所选内容的末尾设为活动状态。To make sure that any currently selected text stays selected during the extension, the end of the selection is made active first. (例如, 如果选择了此段落的前三个单词, 但所选内容的开始部分处于活动状态, 则MoveRight方法调用将取消选定的前两个单词。)(For example, if the first three words of this paragraph were selected but the start of the selection were active, the MoveRight method call would cancel the selection of the first two words.)

With Selection 
 .StartIsActive = False 
 .MoveRight Unit:=wdWord, Count:=2, Extend:=wdExtend 
End With

下面是使用Flags属性的相同示例。Here is the same example using the Flags property. 此解决方案是有问题的因为您可以仅通过停用 flags 属性 用无关的值覆盖。This solution is problematic because you can only deactivate a Flags property setting by overwriting it with an unrelated value.

With Selection 
 If (.Flags And wdSelStartActive) = wdSelStartActive Then _ 
 .Flags = wdSelReplace 
 .MoveRight Unit:=wdWord, Count:=2, Extend:=wdExtend 
End With

下面是使用MoveEnd方法的相同示例, 无需检查所选内容的哪一结尾是活动的。Here is the same example using the MoveEnd method, which eliminates the need to check which end of the selection is active.

With Selection 
 .MoveEnd Unit:=wdWord, Count:=2 
End With

另请参阅See also

Selection 对象Selection Object

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.