Moves or extends the selection to the beginning of the specified unit. This method returns an integer that indicates the number of characters the selection was actually moved, or it returns 0 (zero) if the move was unsuccessful.
Note This method corresponds to functionality of the HOME key.
expression An expression that returns a Selection object.
Can be one of the following WdUnits constants.
The default value is wdLine.
Can be one of the following WdMovementType constants.
If the value of this argument is wdMove, the selection is collapsed to an insertion point and moved to the beginning of the specified unit. If it's wdExtend, the beginning of the selection is extended to the beginning of the specified unit. The default value is wdMove.
This example moves the selection to the beginning of the current story. If the selection is in the main text story, the selection is moved to the beginning of the document.
Selection.HomeKey Unit:=wdStory, Extend:=wdMove
This example moves the selection to the beginning of the current line and assigns the number of characters moved to the
pos = Selection.HomeKey(Unit:=wdLine, Extend:=wdMove) If pos = 0 Then StatusBar = "Selection was not moved"
Applies to | Selection Object