Selection.StartIsActive Property

Word Developer Reference

True if the beginning of the selection is active. Read/write Boolean.

Syntax

expression.StartIsActive

expression   An expression that returns a Selection object.

Remarks

If the selection is not collapsed to an insertion point, either the beginning or the end of the selection is active. 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.

This property is equivalent to using the Flags property with the wdSelStartActive constant. However, using the Flags property requires binary operations, which are more complicated than using the StartIsActive property.

Example

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. (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.)

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

Here is the same example using the Flags property. This solution is problematic because you can only deactivate a Flags property setting by overwriting it with an unrelated value.

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

Here is the same example using the MoveEnd method, which eliminates the need to check which end of the selection is active.

Visual Basic for Applications
  With Selection
   .MoveEnd Unit:=wdWord, Count:=2
End With

See Also