HomeKey Method Example

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 variable.

pos = Selection.HomeKey(Unit:=wdLine, Extend:=wdMove)
If pos = 0 Then StatusBar = "Selection was not moved"