Muokkaa

Jaa


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

Selection 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.