ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Toggle State on Custom Menu (https://www.excelbanter.com/excel-programming/272391-toggle-state-custom-menu.html)

Devin McMahon

Toggle State on Custom Menu
 
I have a a Custom Menu, with items whose caption comes from the values
in an ado recordset. When I build the menu, I check the registry to
see if the caption on the menu matches a value in a specific key, and
if so that button goes to msoButtonDown

When the user selects a different item, I use ActionControl.Caption to
pass that variable to function and change the value of the registry
key

I then toggle the new choice as msoButtonDown

So far, so good except that the old choice remains msoButtonDown

I looked into Object, and CommandBarControl.FindControl, etc, to
toggle all menu items as msoButtonUp before setting the new value but
all of those examples seem to indicate that you need to know the name
of the control, and since my menu is populated dynamically, I don't
know the name at runtime, or do I?

Will I have to remove and rebuild all the items on the menu, and if so
is there an example I can refer to? Or, am i missing something on
iterating through the buttons?

Thanks


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

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