EndKey Method Example

This example moves the selection to the end of the current line and assigns the number of characters moved to the pos variable.

pos = Selection.EndKey(Unit:=wdLine, Extend:=wdMove)

This example moves the selection to the beginning of the current table column and then extends the selection to the end of the column.

If Selection.Information(wdWithInTable) = True Then
    Selection.HomeKey Unit:=wdColumn, Extend:=wdMove
    Selection.EndKey Unit:=wdColumn, Extend:=wdExtend
End If

This example moves the selection to the end of the current story. If the selection is in the main text story, the example moves the selection to the end of the document.

Selection.EndKey Unit:=wdStory, Extend:=wdMove