Udostępnij za pośrednictwem


How to: Hide Controls on Worksheets when Printing

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

Microsoft Office version

  • Excel 2003

  • Excel 2007

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

When you print a Microsoft Office Excel document that contains Windows Forms controls, the controls are visible on the printed worksheet. You can hide the controls when printing a worksheet.

Note

If you hide controls that display data, such as a TextBox, the data in the control will not be visible on the printed worksheet.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

To hide controls when a worksheet is printed

  1. Create or open an Excel project in Visual Studio Tools for Office and verify that Sheet1 is visible in the designer. For information about creating projects, see How to: Create Visual Studio Tools for Office Projects.

  2. From the Common Controls tab of the Toolbox, drag a Button control to a cell on Sheet1.

  3. In the Properties window, set the PrintObject property to False.

See Also

Tasks

How to: Add Windows Forms Controls to Office Documents

How to: Resize Controls Within Worksheet Cells

Concepts

Windows Forms Controls on Office Documents Overview

Other Resources

Controls on Office Documents