Collapse
Method collapses a selection or cursor to the starting or ending position in a range based on direction. After a selection is collapsed, the starting and ending points turns equal.
Syntax
expression.Collapse(_Direction_)
Direction
Its an optional argument which is variant in nature, following constants can be passed to move cursor in a direction which are the members of WdCollapseDirection enum:
- wdCollapseStart : collapse cursor to start of selection. This is default
- wdCollapseEnd : collapse cursor to the end of selection
Example
Public Sub CollapseExample() 'Grabe Selection Dim oRange As Range Set oRange = Selection.Range 'Collapse Start oRange.Collapse Direction:=wdCollapseStart 'Collapse end oRange.Collapse Direction:=wdCollapseEnd 'Memory cleanup Set oRange = Nothing End Sub
Please leave your comments or queries under comment section also please do subscribe to out blogs to keep your self upto date.