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