Partager via


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.

Syntax

expression .InRange(Range)

expression Required. A variable that represents a Range object.

Parameters

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

Boolean

Remarks

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.

Example

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

Concepts

Range Object

Range Object Members