SetRange Method Example

This example selects the first 10 characters in the document.

Selection.SetRange Start:=0, End:=10

This example uses SetRange to redefine myRange to refer to the first three paragraphs in the active document.

Set myRange = ActiveDocument.Paragraphs(1).Range
myRange.SetRange Start:=myRange.Start, _
    End:=ActiveDocument.Paragraphs(3).Range.End

This example uses SetRange to redefine myRange to refer to the area starting at the beginning of the document and ending at the end of the current selection.

Set myRange = ActiveDocument.Range(Start:=0, End:=0)
myRange.InsertAfter "Hello "
myRange.SetRange Start:=myRange.Start, End:=Selection.End

This example extends the selection to the end of the document.

Selection.SetRange Start:=Selection.Start, _
    End:=ActiveDocument.Content.End