Muokkaa

Jaa


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. 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 Personalize the Visual Studio IDE.

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.