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

Updated: July 2008

Applies to

The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.

Project type

  • Document-level projects

  • Application-level projects

Microsoft Office version

  • Excel 2003

  • Excel 2007

For more information, see Features Available by Application and Project Type.

You can print any worksheet in a workbook.

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

To print a worksheet

The _WorksheetPrintPreview(Object) method enables you to display the specified object in the Print Preview window.

To preview a page before printing

Date

History

Reason

July 2008

Added a code example that can be used in an application-level add-in.

Customer feedback.

Community Additions

ADD
Show:
© 2015 Microsoft