Microsoft KB Archive/111392

= Hiding Button Objects with Visual Basic for Applications =

Article ID: 111392

Article Last Modified on 10/10/2006

-

APPLIES TO


 * Microsoft Excel 97 Standard Edition
 * Microsoft Excel 98 for Macintosh

-



This article was previously published under Q111392





SUMMARY
This article describes two methods for preventing buttons from printing when you print the worksheet that contains the buttons.

NOTE: In Microsoft Excel 97 and Microsoft Excel 98, buttons within a worksheet are not printed by default.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To print a worksheet without printing button objects, follow the appropriate procedure below.

If the Worksheet Does Not Contain Other Graphic Objects

 * 1) On the Edit menu, click Go To.
 * 2) Click Special to open the Go To Special dialog box.
 * 3) In the Go To Special dialog box, click the Objects option to select all objects on the worksheet. Click OK.
 * 4) On the Format menu, click Object, and then click the Properties tab.
 * 5) On the Properties tab, clear the Print Object check box. Click OK to accept the change.

If the Worksheet Contains Other Graphic Objects In Addition To Buttons
 On the Insert menu, point to Macro, and then click Module.

In Microsoft Excel 97 or Microsoft Excel 98, click the Tools menu, point to Macro, and then click Visual Basic Editor. On the Insert menu, click Module.  In the new module, type the following Visual Basic code: Sub Print_No_Buttons ActiveSheet.Buttons.Select End Sub  Return to the sheet that contains the buttons. Click Macro on the Tools menu. (In Microsoft Excel 97 or Microsoft Excel 98, click the Tools menu, point to Macro, and then click Macros.) In the Macro dialog box, select the Print_No_Buttons macro, and click Run.

All of the buttons on the active worksheet are now selected. Click Object on the Format menu and click the Properties tab. Clear the "Print Object" check box, and then click OK.

When you print out this worksheet, the buttons will not be printed.</li></ol>

NOTE: When you choose the Objects option in the Go To Special dialog box, all objects are selected. This means that if the Print Object check box is cleared, none of the graphic objects will be printed.

Additional query words: 5.00a 5.00c 7.00a 8.00 XL97 XL98 VBAEq XL

Keywords: kbdtacode kbhowto kbprogramming KB111392

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.