PDA

View Full Version : Solved: Stop buttons from printing



blackie42
07-03-2009, 01:01 AM
Hi,

Have several sheets that have buttons to open forms etc.

When I print the sheet the buttons also print - any way to stop?

thanks in advance

Jon

Bob Phillips
07-03-2009, 01:39 AM
Build yourself a nice menu and ditch the buttons.

If you call the code in the appropriate workbook open event, and delete it in the close it will exist only for that workbook.

Sub MultiLevelMenus()
Dim oCb As CommandBar
Dim oCtl1 As CommandBarPopup
Dim oCtl2 As CommandBarPopup
Dim oCtl3 As CommandBarPopup
Dim oCtlBtn As CommandBarButton

Set oCb = Application.CommandBars("Worksheet Menu Bar")
With oCb
Set oCtl1 = .Controls("Tools").Controls.Add( _
Type:=msoControlPopup, _
temporary:=True)
oCtl1.Caption = "Level1"
With oCtl1
Set oCtlBtn = .Controls.Add( _
Type:=msoControlButton)
oCtlBtn.Caption = "Level1 Button1"
oCtlBtn.FaceId = 161
oCtlBtn.OnAction = "myLevel1Button1Macro"
With oCtl1
Set oCtl2 = .Controls.Add( _
Type:=msoControlPopup)
oCtl2.Caption = "Level2"
With oCtl2
Set oCtlBtn = .Controls.Add( _
Type:=msoControlButton)
oCtlBtn.Caption = "Level2 Button1"
oCtlBtn.FaceId = 161
oCtlBtn.OnAction = "myLevel2Button1Macro"
Set oCtl3 = .Controls.Add( _
Type:=msoControlPopup)
oCtl3.Caption = "Level3"
With oCtl3
Set oCtlBtn = .Controls.Add( _
Type:=msoControlButton)
oCtlBtn.Caption = "Level3 Button1"
oCtlBtn.FaceId = 161
oCtlBtn.OnAction = "myLevel3Button1Macro"
End With
End With
End With
'etc.
End With
End With
End Sub

rbrhodes
07-03-2009, 01:47 AM
xld,

Where's the delete code <g>

b42,

If the buttons are from the Forms toolbar, right click on the button, Choose 'Format Control' then properties. You'll see a "Print Object' check box.

If the buttons are from the Controls toolbar, choose 'View/Toolbars/Control Toolbox. Select 'Design Mode' (little triangle/Ruler Icon). Right click on the button and choose 'Properties. Scroll down until you see Print and "True".. Change that to false, close, save and bail.

blackie42
07-03-2009, 04:46 AM
Thanks guys - sorted