Selection.IsEqual method (Word)
True if the selection to which this method is applied is equal to the range specified by the Range argument.
expression Required. A variable that represents a Selection object.
|Range||Required||Range||The range to compare with the current selection.|
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.
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
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.