Consulting

Results 1 to 4 of 4

Thread: Solved: Stop buttons from printing

  1. #1

    Solved: Stop buttons from printing

    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

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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.

    [vba]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[/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Expert
    Joined
    Feb 2005
    Location
    Nanaimo, British Columbia, Cananda
    Posts
    568
    Location
    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.
    Cheers,

    dr

    "Questions, help and advice for free, small projects by donation. large projects by quote"

    http:\\www.ExcelVBA.joellerabu.com

  4. #4
    Thanks guys - sorted

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •