Range.InRange method (Word)

Returns True if the range to which the method is applied is contained in the range specified by the Range argument.


expression. InRange( _Range_ )

expression Required. A variable that represents a Range object.


Name Required/Optional Data type Description
Range Required Range Specifies the range that this method uses to determine if it is contained within the specified Range object.

Return value



This method determines whether the range returned by expression is contained in the specified Range by comparing the starting and ending character positions and the story type.


This example sets myRange equal to the first word in the active document. If myRange is not contained in the selected range, myRange is selected.

Set myRange = ActiveDocument.Words(1) 
If myRange.InRange(Selection.Range) = False Then myRange.Select

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.