Share via


Selection.IsEqual Method (Word)

True if the selection to which this method is applied is equal to the range specified by the Range argument.

Syntax

expression .IsEqual(Range)

expression Required. A variable that represents a Selection object.

Parameters

Name

Required/Optional

Data Type

Description

Range

Required

Range

The range to compare with the current selection.

Return Value

Boolean

Remarks

This method compares the starting and ending character positions and the story type. If all three of these items are the same for both the selection and the object specified by the Range argument, the objects are equal.

Example

This example compares the selection with the second paragraph in the active document. If the selection isn't equal to the second paragraph, the second paragraph is selected.

If Selection.IsEqual(ActiveDocument _ 
 .Paragraphs(2).Range) = False Then 
 ActiveDocument.Paragraphs(2).Range.Select 
End If

See Also

Concepts

Selection Object Members

Selection Object