Share via


Document Object [Publisher 2003 VBA Language Reference]

Multiple objects
Document
Multiple objects

Represents a publication.

Using ActiveDocument

Use the ActiveDocument property to refer to the current publication. This example adds a table to the first page of the active publication.

Sub NewTable()
    With ActiveDocument.Pages(1).Shapes
        .AddTable NumRows:=3, NumColumns:=3, Left:=72, Top:=300, _
            Width:=488, Height:=36
        With .Item(1).Table.Rows(1)
            .Cells(1).TextRange.Text = "Column1"
            .Cells(2).TextRange.Text = "Column2"
            .Cells(3).TextRange.Text = "Column3"
        End With
    End With
End Sub

You can also write the above routine by using a reference to the ThisDocument module. This example uses a ThisDocument reference instead of ActiveDocument.

Sub PrintPublication()
    With ThisDocument.Pages(1).Shapes
        .AddTable NumRows:=3, NumColumns:=3, Left:=72, Top:=300, _
            Width:=488, Height:=36
        With .Item(1).Table.Rows(1)
            .Cells(1).TextRange.Text = "Column1"
            .Cells(2).TextRange.Text = "Column2"
            .Cells(3).TextRange.Text = "Column3"
        End With
    End With
End Sub

Properties | ActivePrinter Property | ActiveView Property | ActiveWindow Property | AdvancedPrintOptions Property | Application Property | BorderArts Property | ColorMode Property | ColorScheme Property | ColorsInUse Property | DefaultTabStop Property | DocumentDirection Property | EnvelopeVisible Property | Find Property | FullName Property | IsDataSourceConnected Property | IsWizard Property | LayoutGuides Property | MailEnvelope Property | MailMerge Property | MasterPages Property | Name Property | Pages Property | PageSetup Property | Parent Property | Path Property | PersonalInformationSet Property | Plates Property | PrintPageBackgrounds Property | PublicationType Property | ReadOnly Property | RedoActionsAvailable Property | RemovePersonalInformation Property | Saved Property | SaveFormat Property | ScratchArea Property | Sections Property | Selection Property | Stories Property | Tags Property | TextStyles Property | UndoActionsAvailable Property | ViewBoundariesAndGuides Property | ViewHorizontalBaseLineGuides Property | ViewTwoPageSpread Property | ViewVerticalBaseLineGuides Property | WebNavigationBarSets Property | Wizard Property

Methods | BeginCustomUndoAction Method | Close Method | ConvertPublicationType Method | CreatePlateCollection Method | EndCustomUndoAction Method | EnterColorMode Method | FindShapeByWizardTag Method | FindShapesByTag Method | PrintOut Method | Redo Method | Save Method | SaveAs Method | Undo Method | UndoClear Method | UpdateOLEObjects Method | WebPagePreview Method

Events | BeforeClose Event | Open Event | Redo Event | ShapesAdded Event | ShapesRemoved Event | Undo Event | WizardAfterChange Event

Parent Objects | Application Object | Documents Collection

Child Objects | AdvancedPrintOptions Object | BorderArts Object | ColorScheme Object | ColorsInUse Object | FindReplace Object | LayoutGuides Object | MailMerge Object | MasterPages Object | Pages Object | PageSetup Object | Plates Object | ScratchArea Object | Sections Object | Selection Object | Stories Object | Tags Object | TextStyles Object | View Object | WebNavigationBarSets Object | Window Object | Wizard Object