This documentation is archived and is not being maintained.

Document.StoryRanges Property

Office 2007
Returns a StoryRanges collection that represents all the stories in the specified document. Read-only.



expression   A variable that represents a Document object.


For information about returning a single member of a collection, see Returning an Object from a Collection.


This example steps through the StoryRanges collection to determine whether wdPrimaryFooterStory is part of the StoryRanges collection.

Visual Basic for Applications
For Each aStory In ActiveDocument.StoryRanges
    If aStory.StoryType = wdEvenPagesFooterStory Then 
        MsgBox "Document includes an even page footer"
    End If
Next aStory

This example adds text to the primary header story and then displays the text.

Visual Basic for Applications
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range _
    .Text = "Header text"
MsgBox ActiveDocument.StoryRanges(wdPrimaryHeaderStory).Text