Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

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.

↑ Back to the top


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 Microsoft Advisory Services. For more information, visit these Microsoft Web sites:

Microsoft Certified Partners - https://partner.microsoft.com/global/30000104

Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice

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.
  4. On the Format menu, click Control. In the Format Control dialog box, click the Properties tab.
  5. 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

  1. On the Tools menu, point to Macro, and then click Visual Basic Editor.
  2. 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
    					
  3. Press ALT+F11 to return to the worksheet that contains the buttons. On the the Tools menu, point to Macro, and then click Macros.
  4. In the Macro dialog box, click Print_No_Buttons, and then click Run.

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

    When you print this worksheet, the buttons are not printed.
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.

↑ Back to the top


Keywords: KB213832, kbprogramming, kbinfo, kbhowto, kbdtacode

↑ Back to the top

Article Info
Article ID : 213832
Revision : 8
Created on : 11/23/2006
Published on : 11/23/2006
Exists online : False
Views : 288