Share via


Story Object [Publisher 2003 VBA Language Reference]

Multiple objects
Story
Multiple objects

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

Properties | Application Property | HasTable Property | HasTextFrame Property | Parent Property | Table Property | TextFrame Property | TextRange Property | Type Property

Parent Objects | TextFrame Object | TextRange Object

Child Objects | Table Object | TextFrame Object | TextRange Object