<?xml encoding=”UTF-8″>By Adam Nagy
When adding VBA macro functions to the Ribbon through the “Customize User Commands…” button then they will appear in the “User Commands” panel.
RibbonPanel names cannot be changed, but maybe the panels could be replaced by other ones.
Instead of doing that though, I think the easiest might be just to create your own panel and add the macros to that.
In this case I only have these two macros in my “Module1” and when I run “CreateMyPanel” then it will create a new panel called “MyPanel” and add a reference in it to the “MyMessage” macro.
Sub MyMessage()
MsgBox "My message"
End Sub
Sub CreateMyPanel()
Dim rs As Ribbons
Set rs = ThisApplication.UserInterfaceManager.Ribbons
Dim cds As ControlDefinitions
Set cds = ThisApplication.CommandManager.ControlDefinitions
Dim cd As MacroControlDefinition
Set cd = cds.AddMacroControlDefinition("Module1.MyMessage")
Dim r As Ribbon
Set r = rs("Part")
Dim t As RibbonTab
Set t = r.RibbonTabs("id_TabTools")
Dim p As RibbonPanel
Set p = t.RibbonPanels.Add("MyPanel", "MyName.MyPanel", "MyName.MyPanel")
Call p.CommandControls.AddMacro(cd)
End Sub
One thing to bear in mind is that programmatically added UI elements are not persisted. So you would have to run your command that adds the extra ribbon panel each time Inventor starts. The best way to do that would be to create an addin for that.




Leave a Reply