PrintOut [WksDocument]

 

The PrintOut method prints the worksheet.

 

Syntax

object.PrintOut( FromPage, ToPage, Copies, Collate, Selection, PrinterName, PrintToFileName )

 

Parameter

Type

Description

FromPage

Long

optional; default=1, first page to print

ToPage

Long

optional; default=0xffff, last page to print

Copies

Long

optional; default=1, number of copies to print

Collate

Boolean

optional; default=0, collate copies

Selection

String

optional; default="", print selected cells only

PrinterName

String

optional; default="", printer name, if empty your default printer is used

PrintToFileName

String

optional; default="", print to file rather than to a printer

 

Remarks

If FromPage, ToPage, or Selection is left blank, the entire document prints. This is the equivalent of the All option in the worksheet Print dialog box. The Selection parameter Ranges are specified in three ways:

  1. As a rectangular range, "A1:C5"

  2. As a range of whole columns, "A:C"

  3. As a range of whole rows, "1:5"

 

Example

This example demonstrates how to print only cells A1:C5.

 

Wks. PrintOut (Selection:="A1:C5")

 

Used by: WksDocument object