PageSetup object (Excel)
Represents the page setup description.
Remarks
The PageSetup object contains all page setup attributes (left margin, bottom margin, paper size, and so on) as properties.
Example
Use the PageSetup property of the Worksheet object to return a PageSetup object.
The following example sets the orientation to landscape mode and then prints the worksheet.
With Worksheets("Sheet1")
.PageSetup.Orientation = xlLandscape
.PrintOut
End With
The With statement makes it easier and faster to set several properties at the same time. The following example sets all the margins for worksheet one.
With Worksheets(1).PageSetup
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1.5)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
End With
Properties
- AlignMarginsHeaderFooter
- Application
- BlackAndWhite
- BottomMargin
- CenterFooter
- CenterFooterPicture
- CenterHeader
- CenterHeaderPicture
- CenterHorizontally
- CenterVertically
- Creator
- DifferentFirstPageHeaderFooter
- Draft
- EvenPage
- FirstPage
- FirstPageNumber
- FitToPagesTall
- FitToPagesWide
- FooterMargin
- HeaderMargin
- LeftFooter
- LeftFooterPicture
- LeftHeader
- LeftHeaderPicture
- LeftMargin
- OddAndEvenPagesHeaderFooter
- Order
- Orientation
- Pages
- PaperSize
- Parent
- PrintArea
- PrintComments
- PrintErrors
- PrintGridlines
- PrintHeadings
- PrintNotes
- PrintQuality
- PrintTitleColumns
- PrintTitleRows
- RightFooter
- RightFooterPicture
- RightHeader
- RightHeaderPicture
- RightMargin
- ScaleWithDocHeaderFooter
- TopMargin
- Zoom
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.