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

  1. Call the M:Microsoft.Office.Tools.Excel.Worksheet.PrintOut(System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object) method of Sheet1, request two copies, and preview the document before printing.

    No code example is currently available or this language may not be supported.

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

  1. Call the PrintPreview method of the worksheet.

    No code example is currently available or this language may not be supported.

To print a worksheet

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

    No code example is currently available or this language may not be supported.

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

To preview a page before printing

  1. Call the _Worksheet.PrintPreview method of the active worksheet.

    No code example is currently available or this language may not be supported.

Working with Worksheets
How to: Programmatically Check Spelling in Worksheets
Worksheet Host Item
Global Access to Objects in Office Projects
Optional Parameters in Office Solutions

Show: