Consulting

Results 1 to 8 of 8

Thread: Toggle on/off a command bar PowerPoint 2003

  1. #1
    VBAX Regular
    Joined
    Apr 2015
    Posts
    27
    Location

    Toggle on/off a command bar PowerPoint 2003

    Hi all!

    I have a few buttons with action coded on a module. I am wanting to create a toggle button to toggle on/off that series of buttons on the toolbar..
    How would I do that?

    Any advice/help most appreciated!


    Best regards
    Philippe

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Try adding a uniwue tag when you make the button
    With .Add(Type:=msoControlButton)
        .Caption = "Move Down"
        .Style = msoButtonIcon
        .OnAction = "MoveDown"
        .FaceId = 3275
        .Tag = "myUniqueTag"
    End With
    Then you should (this is top of head) be able to say

    Sub toggle()
    Dim cb As CommandBarButton
    Set cb = CommandBars.FindControl(Type:=msoControlButton, Tag:="myUniqueTag")
    cb.Visible = Not cb.Visible
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Regular
    Joined
    Apr 2015
    Posts
    27
    Location
    Loving this John! Thank you very much.

    Is there a way I can position the button (Not the toggle, the other button). The reason I ask is, I would like to have the buttons showing below a command bar I already have.

    Thank you for your expert advice!

    Kind regards,
    Philippe

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    You cannot position a button. You would need to have the button in a new commandbar and play with .Top .Left and .Position
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  5. #5
    VBAX Regular
    Joined
    Apr 2015
    Posts
    27
    Location
    Thanks John! That makes sense... Is it a lot of rework to place that button in a command bar so I can position it? (Just wondering...)

    Best regards and thanks again for the support!
    Philippe

  6. #6
    VBAX Regular
    Joined
    Apr 2015
    Posts
    27
    Location
    Hi John,

    It seems as if the code only hides 1 single tagged object. If I have more than 1 tagged object as "myUniqueTag", it only hides 1 and ignore the others... Can you help?

    Kind regards,
    Philippe

  7. #7
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Unique means unique. Create several unique tags.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  8. #8
    VBAX Regular
    Joined
    Apr 2015
    Posts
    27
    Location
    Thanks John! Makes total sense indeed, I thought there was a way to use one uniqe tag for a group of buttons.

    Best regards,
    Philippe

Tags for this Thread

Posting Permissions

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