Selection.InStory method (Word)

True if the selection 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 Selection object.

Parameters

Name Required/Optional Data type Description
Range Required Range The range whose story is compared with the story of the current selection.

Return value

Boolean

Remarks

A range can belong to only one story.

Example

This example determines whether the selection is in the same story as the first paragraph in the active document. The message box displays "False" because the selection is in the primary header story and the first paragraph is in the main text story.

With ActiveDocument.ActiveWindow.View 
 .Type = wdPrintView 
 .SeekView = wdSeekCurrentPageHeader 
End With 
same = Selection.InStory(ActiveDocument.Paragraphs(1).Range) 
MsgBox same

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.