Name

workbook.PrintOut([From], [To], [Copies], [Preview], [ActivePrinter], [PrintToFile], [Collate], [PrToFileName])

Synopsis

Prints the workbook.

Argument

Settings

From

The starting page number to print.

To

The ending page number to print.

Copies

The number of copies to print.

Preview

True previews the workbook before printing; False does not (default).

ActivePrinter

The name of the printer to use.

PrintToFile

True sends output to a file; False sends output to the printer (default).

Collate

True prints in collated order; False prints from first page to last (default).

PrToFileName

If PrintToFile is True, the name of the file to create; Excel prompts for a filename if PrintToFile is True and this argument is omitted.

The following code prints the first page of the current workbook:

ThisWorkbook.PrintOut 1, 1

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.