PrintOut [Worksheet]
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 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:
- As a rectangular range, "A1:C5"
- As a range of whole columns, "A:C"
- As a range of whole rows, "1:5"
Example
This example demonstrates how to print only cells A1:C5.
Wks.PrintOut (,,,,"A1:C5")
Used by: Worksheet object