Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
How to: Programmatically Print Worksheets

How to: Programmatically Print Worksheets

You can print any worksheet in a workbook.

Applies to: The information in this topic applies to document-level projects and VSTO add-in projects for Excel. For more information, see Features Available by Office Application and Project Type.

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);
    

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

To print a worksheet

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

    ((Excel.Worksheet)Application.ActiveSheet).PrintOut
        (1, 1, 2, true);
    

The _Worksheet.PrintPreview method enables you to display the specified object in the Print Preview window.

To preview a page before printing

Show:
© 2015 Microsoft