Print related procedures in class PageSetup (Excel VBA)
This page presents procedures from class PageSetup related to the theme Print: DifferentFirstPageHeaderFooter, EvenPage, FirstPage, FirstPageNumber, FitToPagesTall, FitToPagesWide, OddAndEvenPagesHeaderFooter, Pages, PrintArea, PrintComments, PrintErrors, PrintGridlines, PrintHeadings, PrintNotes, PrintQuality, PrintTitleColumns and PrintTitleRows
DifferentFirstPageHeaderFooter
True if a different header or footer is used on the first page.
ActiveChart.PageSetup.DifferentFirstPageHeaderFooter = True
EvenPage
Returns or sets the alignment of text on the even page of a workbook or section.
Dim pagEvenPage As Page
Set pagEvenPage = ActiveChart.PageSetup.EvenPage
FirstPage
Returns or sets the alignment of text on the first page of a workbook or section.
Dim pagFirstPage As Page
Set pagFirstPage = ActiveChart.PageSetup.FirstPage
FirstPageNumber
Returns or sets the first page number that will be used when this sheet is printed. If xlAutomatic, Microsoft Excel chooses the first page number. The default is xlAutomatic (Constants).
ActiveChart.PageSetup.FirstPageNumber = 100
FitToPagesTall
Returns or sets the number of pages tall that the worksheet will be scaled to when it's printed. Applies only to worksheets.
If this property is False, Microsoft Excel scales the worksheet according to the FitToPagesWide property. If the Zoom property is True, the FitToPagesTall property is ignored.
With Worksheets("Sheet1").PageSetup
.Zoom = False
.FitToPagesTall = 1
.FitToPagesWide = 1
End With
FitToPagesWide
Returns or sets the number of pages wide that the worksheet will be scaled to when it's printed. Applies only to worksheets.
If this property is False, Microsoft Excel scales the worksheet according to the FitToPagesTall property. If the Zoom property is True, the FitToPagesWide property is ignored.
ActiveChart.PageSetup.FitToPagesWide = 1
OddAndEvenPagesHeaderFooter
True if the specified PageSetup object has different headers and footers for odd-numbered and even-numbered pages.
ActiveChart.PageSetup.OddAndEvenPagesHeaderFooter = True
Pages
Returns or sets the count or item number of the pages in the Pages collection.
Dim pgsPages As Pages
Set pgsPages = ActiveChart.PageSetup.Pages
PrintArea
Returns or sets the range to be printed as a String using A1-style references in the language of the macro.
Set this property to False or to the empty string ("") to set the print area to the entire sheet. This property applies only to worksheet pages.
PrintComments
Returns or sets the way comments are printed with the sheet.
Possible Values are xlPrintInPlace - Comments will be printed where they were inserted on the worksheet, xlPrintNoComments - Comments will not be printed, xlPrintSheetEnd - Comments will be printed as end notes at the end of the worksheet.Worksheets("Sheet1").PageSetup.PrintComments = xlPrintInPlace
PrintErrors
Sets or returns an XlPrintErrors constant specifying the type of print error displayed. This feature allows users to suppress the display of error values when printing a worksheet.
Possible Values are xlPrintErrorsBlank - Print errors are blank, xlPrintErrorsDash - Print errors are displayed as dashes, xlPrintErrorsDisplayed - All print errors are displayed, xlPrintErrorsNA - Print errors are displayed as not available.Worksheets("Sheet1").PageSetup.PrintErrors = xlPrintErrorsBlank
PrintGridlines
True if cell gridlines are printed on the page. Applies only to worksheets.
ActiveChart.PageSetup.PrintGridlines = True
PrintHeadings
True if row and column headings are printed with this page. Applies only to worksheets.
The DisplayHeadings property of the Window object controls the on-screen display of headings.
ActiveChart.PageSetup.PrintHeadings = True
PrintNotes
True if cell notes are printed as end notes with the sheet. Applies only to worksheets.
Use the PrintComments property to print comments as text boxes or end notes.
ActiveChart.PageSetup.PrintNotes = True
PrintQuality
Returns or sets the print quality.
Syntax : expression.PrintQuality (Index)
Index: Horizontal print quality (1) or vertical print quality (2). Some printers may not support vertical print quality. If you don't specify this argument, the PrintQuality property returns (or can be set to) a two-element array that contains both horizontal and vertical print quality.
Worksheets("Sheet1").PageSetup.PrintQuality = Array(240, 140)
PrintTitleColumns
Returns or sets the columns that contain the cells to be repeated on the left side of each page, as a String in A1-style notation in the language of the macro.
If you specify only part of a column or columns, Microsoft Excel expands the range to full columns. Set this property to False or to the empty string ("") to turn off title columns. This property applies only to worksheet pages.
Worksheets("Sheet1").Activate
ActiveSheet.PageSetup.PrintTitleRows = ActiveSheet.Rows(3).Address
ActiveSheet.PageSetup.PrintTitleColumns = _
ActiveSheet.Columns("A:C").Address
PrintTitleRows
Returns or sets the rows that contain the cells to be repeated at the top of each page, as a String in A1-style notation in the language of the macro.
If you specify only part of a row or rows, Microsoft Excel expands the range to full rows. Set this property to False or to the empty string ("") to turn off title rows. This property applies only to worksheet pages.