This documentation is archived and is not being maintained.

How to: Print Worksheets


Some code examples in this topic use the this or Me keyword or the Globals class in a way that is specific to document-level customizations, or they rely on features of document-level customizations such as host controls. These examples can be compiled only if you have the required applications installed. For more information, see Features Available by Product Combination.

The PrintOut method enables you to print the specified object. You can include a number of optional parameters, including a range of pages to print, the number of copies, whether you want to preview before printing, the name of the printer to use, whether you want to print to a file, whether you want to collate, and the name of the file you want to print to.

To print a worksheet

  • Call the PrintOut method of Sheet1, request two copies, and preview the document before printing.

    Globals.Sheet1.PrintOut(1, 1, 2, true, missing, missing, missing, missing);

The PrintPreview method enables you to display the specified object in the Print Preview window. The following code assumes you have a Worksheet host item named Sheet1.

To preview a page before printing

  • Call the PrintPreview method of the worksheet.


See Also