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