IsEqual Method 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

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