Share via


Story Object

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.


Aa662079.parchild(en-us,office.10).gifStory
Aa662079.space(en-us,office.10).gifAa662079.parchild(en-us,office.10).gif

Represents the text in an unlinked text frame, text flowing between linked text frames, or text in a table cell. The Story object is a member of the TextFrame and TextRange objects and the Stories collection.

Using the Story object

Use the Story property to return the Story object in a text range or text frame. This example returns the story in the selected text range and, if it is in a text frame, inserts text into the text range.

  Sub AddTextToStory()
    With Selection.TextRange.Story
        If .HasTextFrame Then .TextRange _
            .InsertAfter NewText:=vbLf & "This is a test."
    End With
End Sub

Use Stories(index), where index is the number of the story, to return an individual Story object. This example determines if the first story in the active publication has a text frame and, if it does, formats the paragraphs in the story with a half inch first line indent and a six-point spacing before each paragraph.

  Sub StoryParagraphFirstLineIndent()
    With ActiveDocument.Stories(1)
        If .HasTextFrame Then
            With .TextFrame.TextRange.ParagraphFormat
                .FirstLineIndent = InchesToPoints(0.5)
                .SpaceBefore = 6
            End With
        End If
    End With
End Sub