- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Is there any way to add a button to the ribbon for a VBA macro, but be able to have spaces in the button's name?
I know how to add a macro to the ribbon using the CommandControls.AddMacro method. However, that method only takes MacroControlDefinitions as the control definition input, and MacroControlDefinitions are created using ControlDefinitions.AddMacroControlDefinition, which gives no provision for specifying a DisplayName. After creation, the DisplayName property is read-only and is locked to the macro's VBA sub name, which cannot have spaces in it.
I'm wondering if maybe it's possible to assign a VBA macro as the OnExecute event for a ButtonDefinition? If so, then we could create the macro's button definition using ControlDefinitions.AddButtonDefinition, which DOES allow you to set the DisplayName at creation.
Is this possible? Or is there any other way to set a custom display name for a VBA macro button?
Solved! Go to Solution.