Range.InStory Method

Word Developer Reference

True if the range to which this method is applied is in the same story as the range specified by the Range argument.

Syntax

expression.InStory(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

A range can belong to only one story.

Example

This example determines whether Range1 and Range2 are in the same story. If they are, bold formatting is applied to Range1.

Visual Basic for Applications
  Set Range1 = Selection.Words(1)
Set Range2 = ActiveDocument.Range(Start:=20, End:=100)
If Range1.InStory(Range:=Range2) = True Then
    Range1.Font.Bold = True
End If

See Also