WksPageSetup Object

The WksPageSetup object contains all the parameters in the worksheet window Page Setup dialog.

The following table provides the properties of the WksPageSetup object:

Property

Description

AdjustToPercentage

Returns/sets the printing enlargement or reduction percentage. A value of zero indicates that reduction should be done according to the FitToPagesAcross and FitToPagesDown settings.

Application

Returns the Application object. It is a read-only property.

BottomMargin

Returns/sets the bottom margin distance.

CenterHorizontally

Returns/sets whether to center the output horizontally.

CenterVertically

Returns/sets whether to center the output vertically.

FitToPagesAcross

Returns/sets the maximum number of pages across to print.

FitToPagesDown

Returns/sets the maximum number of pages down to print.

Footer

Returns/sets the page footer text.

FooterMargin

Returns/sets the footer margin distance.

Header

Returns/sets the page header text.

HeaderMargin

Returns/sets the header margin distance.

LeftMargin

Returns/sets the left margin distance.

Orientation

Returns/sets the page orientation (landscape or portrait).

PaperSize

Returns/sets the paper size.

PaperSource

Returns/sets the printer paper bin.

Parent

Returns the worksheet associated with this PageSetup object. It is a read-only property.

PrintAcrossAndThenDown

Returns/sets whether multiple pages will be printed across rows first and then down (versus down columns first and then across).

PrintBlackAndWhite

Returns/sets whether output will be forced to be in black and white.

PrintGridlines

Returns/sets whether grid lines will be printed.

PrintRowAndColumnHeader

Returns/sets whether row and column headers will be printed.

RightMargin

Returns/sets the right margin distance.

TopMargin

Returns/sets the top margin distance.

Example

The following script demonstrates how the WksPageSetup object is used in reference to the WksDocument object.

Sub Main

 

'Declares SurferApp as an object

Dim SurferApp As Object

 

'Creates an instance of the Surfer Application object and assigns it

'to the variable named "SurferApp"

Set SurferApp = CreateObject("Surfer.Application")

 

'Makes Surfer visible

SurferApp.Visible = True

 

'Declares Wks as an object

Dim Wks As Object

 

'Creates a worksheet document in Surfer and assigns it to the variable

'named "Wks"

Set Wks = SurferApp.Documents.Add(srfDocWks)

 

'Declares WksPageSetup as an object

Dim WksPageSetup As Object

 

'Assigns the worksheet document page setup to the variable named

'"WksPageSetup"

Set WksPageSetup = Wks.PageSetup

 

End Sub