Microsoft KB Archive/213832

= XL2000: How to Hide Button Controls with Visual Basic for Applications =

Article ID: 213832

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft Excel 2000 Standard Edition

-



This article was previously published under Q213832





SUMMARY
This article describes how to prevent buttons, such as command and option button controls, from being printed in the following situations.
 * If the buttons are the only objects on the worksheet.
 * If the worksheet that you want to print contains other graphic objects in addition to the buttons.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals 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 needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

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) In the Go To dialog box, click Special.
 * 3) In the Go To Special dialog box, click the Objects option button, and then click OK.

All objects on the worksheet are selected.
 * 1) On the Format menu, click Control. In the Format Control dialog box, click the Properties tab.
 * 2) On the Properties tab, click to clear the Print object check box, and then click OK.

If the Worksheet Contains Other Graphic Objects in Addition to Buttons
 On 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  Press ALT+F11 to return to the worksheet that contains the buttons. On the the Tools menu, point to Macro, and then click Macros. In the Macro dialog box, click Print_No_Buttons, and then click Run.

All of the buttons on the active worksheet are now selected. On the Format menu, click Control. In the Format Control dialog box, click the Properties tab. Click to clear the Print object check box, and then click OK.

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

NOTE: When you click Objects in the Go To Special dialog box, all objects are selected. If you click to clear the Print object check box while the objects are selected, none of the graphic objects are printed.

Additional query words: VBAEq XL2000

Keywords: kbdtacode kbhowto kbinfo kbprogramming KB213832

-

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

© Microsoft Corporation. All rights reserved.