StoryType Property

Microsoft Word Visual Basic

Show All

StoryType Property

       

Returns the story type for the specified range, selection, or bookmark. Read-only WdStoryType.

WdStoryType can be one of these WdStoryType constants.
wdCommentsStory
wdEndnotesStory
wdEvenPagesFooterStory
wdEvenPagesHeaderStory
wdFirstPageFooterStory
wdFirstPageHeaderStory
wdFootnotesStory
wdMainTextStory
wdPrimaryFooterStory
wdPrimaryHeaderStory
wdTextFrameStory

expression.StoryType

expression   Required. An expression that returns one of the objects in the Applies To list.

Example

This example returns the story type of the selection.

story = Selection.StoryType

This example closes the footnote pane if the selection is contained in the footnote story.

ActiveDocument.ActiveWindow.View.Type = wdNormalView
If Selection.StoryType = wdFootnotesStory Then _
    ActiveDocument.ActiveWindow.ActivePane.Close

This example selects the bookmark named "temp" if the bookmark is contained in the main story of the active document.

If ActiveDocument.Bookmarks.Exists("temp") = True Then
    Set myBookmark = ActiveDocument.Bookmarks("temp")
    If myBookmark.StoryType = wdMainTextStory _
        Then myBookmark.Select
End If