ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Custom Command Bar Options (https://www.excelbanter.com/excel-programming/388988-custom-command-bar-options.html)

cory

Custom Command Bar Options
 
Using XL2003, I have a custom command bar in workbook. The command bar
contains a menu that when expanded presents the user with a variety of
options to select ("All Levels","Next Level", "Bottom Level"). My problem is
figuring out how to make the options behave similar to the "Formula Bar" and
"Status Bar" options under the View menu. Only one option should be able to
be selected at a time and I will need to a way to check which option is
selected to provide to another procedure as a parameter. Thanks in advance
for your help.

-Cory

JW[_2_]

Custom Command Bar Options
 
You can use the ActionControl property of the CommandBars collection
to figure out which button was pushed. For example, to make a button
cycle through a pressed/unpressed state, you could use:
If CommandBars.ActionControl.State = msoButtonDown Then
CommandBars.ActionControl.State = msoButtonUp
Else
CommandBars.ActionControl.State = msoButtonDown
End If

You can also pass the caption as well. You can then use the caption
as the paramater in an If statement or Select Case statement to run
the appropriate code.

If I misunderstood your question and gave you completely irrelevant
information, I appologize.

Hope this helps.


Cory wrote:
Using XL2003, I have a custom command bar in workbook. The command bar
contains a menu that when expanded presents the user with a variety of
options to select ("All Levels","Next Level", "Bottom Level"). My problem is
figuring out how to make the options behave similar to the "Formula Bar" and
"Status Bar" options under the View menu. Only one option should be able to
be selected at a time and I will need to a way to check which option is
selected to provide to another procedure as a parameter. Thanks in advance
for your help.

-Cory




All times are GMT +1. The time now is 06:25 PM.

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