Selection.InStory Method (Word)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

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

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

A range can belong to only one story.

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
Show: