Document object (Publisher)

Represents a publication.

Remarks

Use the ActiveDocument property to refer to the current publication.

Example

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 previous 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

Events

Methods

Properties

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.