Compartilhar via


How to: Hide Controls on Worksheets when Printing

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.

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

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 Customizing Development Settings in Visual Studio.

To hide controls when a worksheet is printed

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

  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