This example selects the text from the insertion point to the beginning of the line. The number of characters selected is stored in charmoved
.
Selection.Collapse Direction:=wdCollapseStart
charmoved = Selection.StartOf(Unit:=wdLine, Extend:=wdExtend)
This example moves myRange
to the beginning of the second sentence in the document (myRange
is collapsed and positioned at the beginning of the second sentence). The example uses the Select method to show the location of myRange
.
Set myRange = ActiveDocument.Sentences(2)
myRange.StartOf Unit:=wdSentence, Extend:=wdMove
myRange.Select
This example moves the selection to the beginning of the paragraph.
Selection.StartOf Unit:=wdParagraph, Extend:=wdMove