This documentation is archived and is not being maintained.

Worksheet.PrintOut Method

Prints the worksheet.

Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in

public virtual void PrintOut (
	[OptionalAttribute] Object From,
	[OptionalAttribute] Object To,
	[OptionalAttribute] Object Copies,
	[OptionalAttribute] Object Preview,
	[OptionalAttribute] Object ActivePrinter,
	[OptionalAttribute] Object PrintToFile,
	[OptionalAttribute] Object Collate,
	[OptionalAttribute] Object PrToFileName



The number of the page at which to start printing. If this argument is omitted, printing starts at the beginning.


The number of the last page to print. If this argument is omitted, printing ends with the last page.


The number of copies to print. If this argument is omitted, one copy is printed.


true to have Microsoft Office Excel invoke print preview before printing the object; false (or omitted) to print the object immediately.


Sets the name of the active printer.


true to print to a file. If PrToFileName is not specified, Excel prompts the user to enter the name of the output file.


true to collate multiple copies.


If PrintToFile is set to true, this argument specifies the name of the file you want to print to.

"Pages" in the descriptions of From and To refers to printed pages, not to overall pages in the worksheet.

Optional Parameters

For information on optional parameters, see Understanding Optional Parameters in COM Interop.

The following code example uses the PrintOut method to print the current worksheet to a file name specified by the user.

private void PrintToFile()
    // Make sure the worksheet has some data before printing.
    this.Range["A1", missing].Value2 = "123";
    this.PrintOut(1, 2, 1, false, missing, true, false, missing);