EndKey
EndKey method moves or extends the selection to the end of the specified unit. In this article we will see various methods to extend or move selections. Since this method returns a integer value upto the selection moved else 0 would be returned
Syntax
express.EndKey(unit, extend)
- Unit: Its an optional parameter, The unit by which the selection is to be moved or extended. Can be a WdUnits constant. The default is wdLine.
- wdCell
- wdCharacter
- wdCharacterFormatting
- wdColumn
- wdItem
- wdLine
- wdParagraph
- wdParagraphFormatting
- wdRow
- wdScreen
- wdSection
- wdSentence
- wdStory
- wdTable
- wdWindow
- wdWord
- Extend: Its an optional parameter, Specifies the way the selection is moved. Can be any constant driver by WdMovementType:
- wdExtend
- wdMove
Code example
Public Sub EndKeyExample() 'Declare selection variable Dim oSelection As Selection 'bind selection Set oSelection = Selection 'Select a line oSelection.EndKey Unit:=wdLine, Extend:=True 'Move to end of the documet oSelection.EndKey Unit:=wdStory, Extend:=wdMove 'Memory cleanup Set oSelection = Nothing End Sub
Next >> Microsoft Custom dictionary code example