WksDocument Object

The WksDocument object represents a worksheet document. WksDocument objects are created by the Documents.Add or Documents.Open methods. Cells within a worksheet are accessed through the Cells, Rows, and Columns methods. The active cell and current selection are accessed through a WksWindow object. You can perform a mathematical transformation on worksheet cells and merge files together with the WksDocument object. The WksRange object can be accessed using the Cells, Rows, Columns, and UsedRange properties.

Derived from: Document object (All methods and properties of Document apply to this object.)

The following table provides the properties of the WksDocument object:

Property

Description

DefaultColumnWidth

Returns/sets the default column width for the worksheet.

DefaultFormat

Returns the default Format object for the worksheet. It is a read only property.

DefaultRowHeight

Returns/sets the default row height for the worksheet.

PageSetup

Returns the PageSetup object for the worksheet. It is a read only property.

UsedRange

Returns a Range object which encompasses all the used cells in the worksheet. It is a read-only property.

The following table provides the methods of the WksDocument object:

Method

Description

AssignCoordinateColumns

Sets worksheet coordinate columns.

Cells

Returns a Range object containing one or more cells. This is the same as the Range method below.

Columns

Returns a Range object containing one or more entire columns of cells.

Merge

Combines a worksheet file with the current document.

PrintOut

Prints the worksheet.

ProjectCoordinates

Applies coordinate system projection to columns.

Range

Returns a Range object containing one or more cells. This is the same as the Cells method above.

Rows

Returns a Range object containing one or more entire rows of cells.

SpatialFilter

Filters data spatially.

Transform

Applies a mathematical transform equation to columns. Use Transform3 to apply a mathematical transform equation to columns, rows, or cells.

Transform2

Applies a mathematical transform equation to columns, rows, or cells. Use Transform3 to apply the transform differently for text, numbers, and blank cells.

Transform3

Applies a mathematical transform equation to columns, rows, or cells. Allows transforms to be applied to text, numbers, and blank cells differently.

LoadDB

Loads a database into the current document.

Example

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

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)

 

End Sub