ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Customise Button on toolbar (https://www.excelbanter.com/excel-programming/380866-customise-button-toolbar.html)

Nigel

Customise Button on toolbar
 
I am trying to get a menu button to change its text based on an action

I have a series of commands to either hide or show toolbars


'Group1
Application.CommandBars("Standard").Visible = True
Application.CommandBars("Formatting").Visible = True
Application.CommandBars("Control Toolbox").Visible = True
Application.CommandBars("Hyperion Essbase").Visible = True
Application.CommandBars("Walmac").Visible = False
CommandBars("Worksheet Menu Bar").Enabled = True
Application.DisplayFormulaBar = True


'

'Group2
Application.CommandBars("Standard").Visible = False
Application.CommandBars("Formatting").Visible = False
Application.CommandBars("Control Toolbox").Visible = False
Application.CommandBars("Hyperion Essbase").Visible = False
CommandBars("Worksheet Menu Bar").Enabled = False
Application.DisplayFormulaBar = False
Application.CommandBars("Walmac").Visible = True

when the action in group1 are done I want the button text to say
HideToolbars, then when I select the button it will do the actions in group2
and the text should change to Show Toolbars and so on

any suggestions

thanks

Bob Phillips

Customise Button on toolbar
 
In the Hide macro , add this code

With Application.CommandBars.ActionControl
.Caption = "Show Toolbars"
End With


and in the show,

With Application.CommandBars.ActionControl
.Caption = "Hide Toolbars"
End With




--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Nigel" wrote in message
...
I am trying to get a menu button to change its text based on an action

I have a series of commands to either hide or show toolbars


'Group1
Application.CommandBars("Standard").Visible = True
Application.CommandBars("Formatting").Visible = True
Application.CommandBars("Control Toolbox").Visible = True
Application.CommandBars("Hyperion Essbase").Visible = True
Application.CommandBars("Walmac").Visible = False
CommandBars("Worksheet Menu Bar").Enabled = True
Application.DisplayFormulaBar = True


'

'Group2
Application.CommandBars("Standard").Visible = False
Application.CommandBars("Formatting").Visible = False
Application.CommandBars("Control Toolbox").Visible = False
Application.CommandBars("Hyperion Essbase").Visible = False
CommandBars("Worksheet Menu Bar").Enabled = False
Application.DisplayFormulaBar = False
Application.CommandBars("Walmac").Visible = True

when the action in group1 are done I want the button text to say
HideToolbars, then when I select the button it will do the actions in

group2
and the text should change to Show Toolbars and so on

any suggestions

thanks





All times are GMT +1. The time now is 04:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com