View Single Post
 
Old 03-27-2014, 10:28 AM
Larry Sulky Larry Sulky is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Mar 2014
Posts: 14
Larry Sulky is on a distinguished road
Question VBA to modify ribbon icon on the fly

In Word 2010, I have to support a Word 2003 toolbar and macro set that does the following: The user can select any of a handful of custom pulldown menus, each of which has a dozen or so buttons. Each button within a given menu calls the same macro, which detects the text name of the button and behaves accordingly. In addition, the behaviour is also affected by whether the visual icon for the button was a "ticked" tick-box, or an "unticked" tick-box. (There is also an "uninitialised" tick-box, but that's a minor issue). Finally, one of the behaviours of the macro is to toggle the icon between its "ticked" and "unticked" forms.

Example:

The user pulls down Menu Omega, and notes that in that menu, Button Alpha is in "unticked" state. The user clicks Button Alpha. This triggers macro XYZ, which:

1. Detects that it was Button Alpha that was clicked, and that the icon is currently the one associated with "unticked" state (by checking the icon's numeric VBA ID).
2. Executes a series of commands appropriate to the intent of "turning on" state Alpha.
3. Changes the icon to the one associated with "ticked" state.

Now the user clicks Button Alpha again. This triggers macro XYZ again, this time with the result that the actions are appropriate to the intent of "turning off" state Alpha, and changing the icon back to "unticked" state.

My problems in Word 2010:
* I'm having a heck of a time creating menus within which to put the buttons.
* I can't figure out how to access the text names or the icon IDs. The properties just aren't the same as in Word 2003.
* I can't figure out how to change the icon IDs on the fly. Again, properties that work fine in Word 2003 aren't there in Word 2010.

Any ideas out there? For the moment, I'm simply keeping an old laptop that has Word 2003 on it, doing the development updates there, then bringing it over into Word 2010, where it works fine. But that's not a good long-term strategy.

TIA....

ON EDIT: I forgot to mention that I wrote the 2003 VBA code.

Last edited by Larry Sulky; 03-27-2014 at 10:32 AM. Reason: more info
Reply With Quote