NextStoryRange Property

Applies To

Range object.

Description

Returns a Range object that refers to the next story, as shown in the following table. Read-only.

Story type

Item returned by the NextStoryRange method

wdMainTextStory, wdFootnotesStory, wdEndnotesStory, wdCommentsStory

Always returns Nothing.

wdTextFrameStory

The story of the next set of linked text boxes.

wdEvenPagesHeaderStory, wdPrimaryHeaderStory, wdEvenPagesFooterStory, wdPrimaryFooterStory, wdFirstPageHeaderStory, wdFirstPageFooterStory

The next section's story of the same type.


See Also

Next property, StoryRanges property, StoryType property.

Example

This example adds text to the even headers in the first two sections in the active document.

If ActiveDocument.Sections.Count >= 2 Then
    With ActiveDocument
        .PageSetup.OddAndEvenPagesHeaderFooter = True
        .Sections(1).Headers(wdHeaderFooterEvenPages).Range.Text = "Even Header"
        .Sections(2).Headers(wdHeaderFooterEvenPages).LinkToPrevious = False
        .StoryRanges(wdEvenPagesHeaderStory).NextStoryRange.Text = "Even Header 2"
    End With
End If
This example searches each story in the active document for the text "Microsoft Word." The example also applies italic formatting to any instances of this text that it finds.

For Each myStoryRange In ActiveDocument.StoryRanges
    myStoryRange.Find.Execute FindText:="Microsoft Word", Forward:=True
    While myStoryRange.Find.Found
        myStoryRange.Italic = True
        myStoryRange.Find.Execute FindText:="Microsoft Word", Forward:=True
    Wend
    While Not (myStoryRange.NextStoryRange Is Nothing)
        Set myStoryRange = myStoryRange.NextStoryRange
        myStoryRange.Find.Execute FindText:="Microsoft Word", Forward:=True
        While myStoryRange.Find.Found
            myStoryRange.Italic = True
            myStoryRange.Find.Execute FindText:="Microsoft Word", _
                Forward:=True
        Wend
    Wend
Next myStoryRange