PrintOut [WksDocument]
PrintOut prints the worksheet. Returns a Boolean. It returns 'True', if printing is successful, otherwise, returns 'False'.
Syntax
object.PrintOut( FromPage, ToPage, Copies, Collate, Selection, PrinterName, PrintToFileName )
Parameter |
Type |
Required/ Optional |
Default |
Description |
FromPage |
Long |
Optional |
|
This specifies the first page to print. |
ToPage |
Long |
Optional |
This specifies the last page to print. |
|
Copies |
Long |
Optional |
|
This specifies the number of copies to print. |
Collate |
Boolean |
Optional |
|
This specifies whether to collate copies |
Selection |
String |
Optional |
"" |
This specifies whether to print selected cells only |
PrinterName |
String |
Optional |
"" |
This specifies the printer name, if empty your default printer is used. |
PrintToFileName |
String |
Optional |
"" |
This provides the file name, when the worksheet should be printed to a file rather than to a printer. |
Remarks
If FromPage, ToPage, or Selection are left blank, the entire document prints. This is the equivalent of the All option in the worksheet Print dialog. 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