Share via


Selection.SetRange Method (Word)

Sets the starting and ending character positions for the selection.

Syntax

expression .SetRange(Start, End)

expression Required. A variable that represents a Selection object.

Parameters

Name

Required/Optional

Data Type

Description

Start

Required

Long

The starting character position of the selection.

End

Required

Long

The ending character position of the selection.

Remarks

Character position values start at the beginning of the story, with the first value being 0 (zero). All characters are counted, including nonprinting characters. Hidden characters are counted even if they're not displayed.

The SetRange method redefines the starting and ending positions of an existing Selection object. This method differs from the Range method, which is used to create a Range object, given a starting and ending position.

Example

This example selects the first 10 characters in the document.

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

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

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

See Also

Concepts

Selection Object Members

Selection Object