MasterPages object (Publisher)
Represents the page master for a publication after which all pages in the publication will be designed. The MasterPages object is a collection of Page objects.
Remarks
Use the Document.MasterPages property to return a MasterPages object.
Use the Page.Shapes property to work with AutoShapes and text boxes on the master page.
Example
The following example adds two ruler guides to the master page so that each page in the active publication is divided into quarters.
Sub ChangeMasterPage()
Dim intWidth As Integer
Dim intHeight As Integer
With ActiveDocument
intWidth = .PageSetup.PageWidth
intWidth = intWidth / 2
intHeight = .PageSetup.PageHeight
intHeight = intHeight / 2
With .MasterPages(1).RulerGuides
.Add Position:=intWidth, _
Type:=pbRulerGuideTypeVertical
.Add Position:=intHeight, _
Type:=pbRulerGuideTypeHorizontal
End With
End With
End Sub
This example adds a small red heart shape to the upper-left corner of the master page that will appear on each page in the active publication.
Sub AddShapeToMasterPage()
ActiveDocument.MasterPages(1).Shapes.AddShape(Type:=msoShapeHeart, _
Left:=36, Top:=36, Width:=36, Height:=36).Fill _
.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
End Sub
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.