object that refers to the next story, as shown in the following table.
Story type | Item returned by the NextStoryRange method |
---|---|
wdMainTextStory, wdFootnotesStory, wdEndnotesStory, and 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 |
expression.NextStoryRange
expression Required. An expression that returns a Range object.
Example
This example adds text to the even headers in the first two sections of the active document.
If ActiveDocument.Sections.Count >= 2 Then
With ActiveDocument
.PageSetup.OddAndEvenPagesHeaderFooter = True
.Sections(1).Headers(wdHeaderFooterEvenPages) _
.Range.Text = "Even Header 1"
.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