Pages Collection

Microsoft Publisher Visual Basic

Pages Collection

Document Pages
Page
Multiple objects

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

Using the Pages collection

Use the Add method to add a new page to a publication. The following example adds a new page and a shape to the active publication.

Sub AddPageAndShape()
    With ActiveDocument.Pages.Add(Count:=1, After:=1)
        With .Shapes.AddShape(Type:=msoShape5pointStar, _
                Left:=72, Top:=72, Width:=50, Height:=50)
            .Fill.ForeColor.RGB = RGB(Red:=128, Green:=50, Blue:=255)
            .Line.ForeColor.RGB = RGB(Red:=75, Green:=50, Blue:=255)
        End With
    End With

End Sub