Range.EndOf (Word)

Moves or extends the ending character position of a range to the end of the nearest specified text unit.

This method returns a value that indicates the number of character positions the range or selection was moved or extended (movement is forward in the document). If the both the starting and ending positions for the range or selection are already at the end of the specified unit, this method doesn't move or extend the range or selection. For example, if the selection is at the end of a word and the trailing space, the following instruction doesn't change the selection ( char equals 0 (zero)).

EndOf (Unit, Extend)


char = Selection.EndOf(Unit:=wdWord, Extend:=wdMove)

Arguments

Optional arguments

The following arguments are optional

Unit (WdUnits) - The unit by which to move the ending character position. Can be any WdUnits, except wdLine. The default value is wdWord.

Here you can find possible values for WdUnits

Extend (WdMovementType) - Specifies whether to move or extend the end of the range. If the value is wdMove, both ends of the range or selection object are moved to the end of the specified unit. If wdExtend is used, the end of the range or selection is extended to the end of the specified unit. The default value is wdMove.

Possible return values are wdExtend - The end of the selection is extended to the end of the specified unit, wdMove - The selection is collapsed to an insertion point and moved to the end of the specified unit. Default.