View Full Version : Toggle on/off a command bar PowerPoint 2003
Exposian
05-13-2015, 03:59 AM
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
John Wilson
05-13-2015, 09:16 AM
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
Exposian
05-13-2015, 10:02 AM
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
John Wilson
05-13-2015, 11:42 PM
You cannot position a button. You would need to have the button in a new commandbar and play with .Top .Left and .Position
Exposian
05-14-2015, 01:39 AM
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
Exposian
06-09-2015, 07:37 AM
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
John Wilson
06-09-2015, 10:10 AM
Unique means unique. Create several unique tags.
Exposian
06-10-2015, 12:58 AM
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
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.