Range.IsEqual method (Word)

True if the range 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 Range object.

Parameters

Name Required/Optional Data type Description
Range Required Range The range to compare with the Range object defined by expression.

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 objects, the objects are equal.

Example

This example compares Range1 with Range2 to determine whether they're equal. If the two ranges are equal, the content of Range1 is deleted.

Set Range1 = Selection.Words(1) 
Set Range2 = ActiveDocument.Words(3) 
If Range1.IsEqual(Range:=Range2) = True Then 
 Range1.Delete 
End If

See also

Range Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.