Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

How to: Print Worksheets

NoteNote

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.

    Globals.Sheet1.PrintPreview(missing);
    
    

See Also

Community Additions

ADD
Show:
© 2015 Microsoft