PageSetup Property

Microsoft Word Visual Basic

PageSetup Property

       

Returns a PageSetup object that's associated with the specified document, range, section, sections, or selection. Read-only.

Example

This example sets the right margin of the active document to 72 points (1 inch).

ActiveDocument.PageSetup.RightMargin = InchesToPoints(1)

This example sets the gutter for the first section in Summary.doc to 36 points (0.5 inch).

Documents("Summary.doc").Sections(1).PageSetup.Gutter = 36

This example sets the header and footer distance to 18 points (0.25 inch) from the top and bottom of the page, respectively. This formatting change is applied to the section that contains the selection.

With Selection.PageSetup
    .FooterDistance = 18
    .HeaderDistance = 18
End With

This example displays the left margin setting, in inches.

MsgBox PointsToInches(ActiveDocument.PageSetup.LeftMargin) _
    & " inches"