Page 180 - Microsoft Office Excel 2003 Programming Inside Out
P. 180
Part 3: The Excel Object Model
Microsoft Office Excel 2003 Programming Inside Out
in Chapter 10, “Formatting Excel Objects,” but it makes sense to discuss how to change the lay-
out of your worksheets on the page by using the PageSetup property of the Worksheet object.
The PageSetup property of the Worksheet object actually returns a PageSetup object, which in
turn contains a series of properties reflecting the worksheet’s positioning, orientation, mar-
Chapter 7
gins, and level of detail when viewed. Table 7-6 lists a number of the more important prop-
erties of the PageSetup object, but you can find a complete listing in the Visual Basic Editor
help system.
Table 7-6. Selected Properties of the PageSetup Object
Property Description
BlackAndWhite When set to True, forces a sheet to be printed in black and white.
BottomMargin Determines the distance, in points, between the top of the footer
and the bottom of the worksheet.
CenterHorizontally When set to True, centers the worksheet horizontally on the
printed page.
CenterVertically When set to True, centers the worksheet vertically on the printed
page.
FirstPageNumber Sets the page number assigned to the first printed page.
FitToPagesTall Sets the number of vertical pages on which the worksheet will be
printed. Useful for shrinking a too-large worksheet onto a specific
number of pages.
FitToPagesWide Sets the number of horizontal pages on which the worksheet will
be printed. Useful for shrinking a too-large worksheet onto a
specific number of pages.
FooterMargin Determines the distance, in points, between the top of the footer
and the bottom of the printed page.
HeaderMargin Determines the distance, in points, between the bottom of the
header and the top of the printed page.
LeftMargin Determines the amount of white space to remain between the
edge of the page and the leftmost element of the worksheet.
Orientation Determines whether a worksheet is in landscape mode
(xlLandscape) or portrait mode (xlPortrait).
RightMargin Determines the amount of white space to remain between the
edge of the page and the rightmost element of the worksheet.
TopMargin Determines the amount of white space to remain between the
bottom of the header and the topmost element of the worksheet.
Zoom Determines the magnification level of the worksheet view between
10 percent and 400 percent.
154