Page Object

Publisher Developer Reference

Represents a page in a publication. The Pages collection contains all the Page objects in a publication.

Example

Use Pages(index) to return a single Page object. The following example adds new text to the first shape on the first page in the active publication.

Visual Basic for Applications
  Sub AddPageNumberField()
    With ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange
        .InsertAfter " This text is added after the existing text."
        .Font.Size = 15
    End With
End Sub

Use the FindBypageID property to locate a Page object using the application assigned page ID. Use the Add method to create a new page and add it to the publication. The following example adds a new page to the active publication and then looks for that page using the page ID.

Visual Basic for Applications
  Sub FindPage()
    Dim lngPageID As Long
'Get page ID
lngPageID = ActiveDocument.Pages.Add(Count:=1, After:=1).PageID

'Use page ID to add a new shape to the page
ActiveDocument.Pages.FindByPageID(PageID:=lngPageID) _
    .Shapes.AddShape Type:=msoShape5pointStar, _
    Left:=200, Top:=72, Width:=50, Height:=50

End Sub

See Also