Page Setup Properties

Name

Returns

Description

AlignMargins HeaderFooter

Boolean

Set/Get whether the header and footer for a given document are aligned with margins set in the page setup options

BlackAndWhite

Boolean

Set/Get whether worksheet items will be printed in black and white only. Not valid when parents are Chart objects

BottomMargin

Double

Set/Get the bottom margin of the page in points

CenterFooter

String

Set/Get the text for the center part of the footer

CenterFooter Picture

Graphic

Read-only. Returns the picture for the center section of the footer

CenterHeader

String

Set/Get the text for the center part of the header

CenterHeader Picture

Graphic

Read-only. Returns the picture for the center section of the footer

Name

Returns

Horizontally

Boolean

Set/Get whether the worksheet or chart will be horizontally centered on the page

Center Vertically

Boolean

Set/Get whether the worksheet or chart will be vertically centered on the page

Different FirstPage HeaderFooter

Boolean

Set/Get whether different header or footer is used on the first page

Draft

Boolean

Set/Get whether graphics will be printed. True means graphics will not be printed

EvenPage

Page

Set/Get the alignment of text on the even page of a workbook or section

FirstPage

Page

Set/Get the alignment of text on the first page of a workbook or section

FirstPage Number

Long

Set/Get which number will be used as the first page number. Use xlAutomatic to have Excel choose this (default)

FitToPages Tall

Variant

Set/Get how many pages tall the sheet will be scaled to. Setting this property to False will mean the FitToPagesWide property will be used

FitToPagesWide

Variant

Set/Get how many pages wide the sheet will be scaled to. Setting this property to False will mean the FitToPagesTall property will be used

FooterMargin

Double

Set/Get the distance from the page's bottom to the footer of the page in points

HeaderMargin

Double

Set/Get the distance from the page's top to the header of the page in points

LeftFooter

String

Set/Get the text for the left part of the footer

LeftFooter Picture

Graphic

Read-only. Returns the picture for the left section of the footer

LeftHeader

String

Set/Get the text for the center part of the header

LeftHeader Picture

Graphic

Read-only. Returns the picture for the left section of the header

LeftMargin

Double

Set/Get the left margin of the page in points

OddAndEvenPages HeaderFooter

Boolean

Set/Get whether the specified PageSetup object has different headers and footers for odd-numbered and even-numbered pages

Name

Returns

Description

Order

XlOrder

Set/Get the manner in which Excel numbers pages for large worksheets (for example, xlDownTheOver, xlOverThenDown). Not valid for parents that are Chart objects

Orientation

XlPage Orientation

Set/Get the page orientation: xlLandscape or xlPortrait

Pages

Pages

Set/Get the count or item number of the pages in Pages collection

PaperSize

XlPaper Size

Set/Get the paper size (for example, xlPaperLetter, xlPaperLegal, and so on)

PrintArea

String

Set/Get the range on a worksheet that will be printed. If this property is set to False, then the entire sheet is printed. Not valid for parents that are Chart objects

PrintComments

XlPrint Location

Set/Get how comments are printed, or if they are at all (for example, xlPrintlnPlace, xlPrintNo-Comments)

PrintErrors

XlPrint Errors

Set/Get the type of print error displayed. This allows the suppression of error values when printing a worksheet

Print Gridlines

Boolean

Set/Get whether cell gridlines are printed for a worksheet. Not valid for parents that are Chart objects

PrintHeadings

Boolean

Set/Get whether row and column headings are printed

PrintNotes

Boolean

Set/Get whether notes attached to the cells are printed at the end as endnotes. Not valid if parents are Chart objects

PrintTitle Columns

String

Set/Get which columns to repeat on the left side of every printed page

PrintTitleRows

String

Set/Get which rows to repeat on the top of every page

RightFooter

String

Set/Get the text for the right part of the footer

RightFooter Picture

Graphic

Read-only. Returns the picture for the right section of the footer

RightHeader

String

Set/Get the text for the right part of the header

RightHeader Picture

Graphic

Read-only. Returns the picture for the right section of the header

Name

Returns

Description

RightMargin

Double

Set/Get the right margin of the page in points

ScaleWithDoc HeaderFooter

Boolean

Set/Get whether the header and footer should be scaled with the document when the size of the document changes

TopMargin

Double

Set/Get the top margin of the page in points

Zoom

Variant

Set/Get the percentage scaling that will occur for the worksheet. Not valid for parents that are Chart objects (10 to 400 percent)

PageSetup Methods

Name

Returns

Parameters Description

PrintQuality

Variant

[Index] Set/Get the print quality. The Index parameter can be used to specify horizontal (1) or vertical (2) print quality

PageSetup Object Example

Sub SetUpPage()

Dim oPS As PageSetup 'Get the sheet's PageSetup object Set oPS = ActiveSheet.PageSetup 'Set up the page With oPS

'Set the paper size to the local default .PaperSize = fnLocalPaperSize .Orientation = xlPortrait 'etc. End With End Sub

Function fnLocalPaperSize() As XlPaperSize

'Remember the paper size when we've read it Static iPaperSize As XlPaperSize 'Is it set?

If iPaperSize = 0 Then

'No, so create a new workbook and read off the paper size With Workbooks.Add iPaperSize = .Worksheets(1).PageSetup.PaperSize .Close False End With End If

'Return the paper size fnLocalPaperSize = iPaperSize End Function

0 0

Post a comment