Create ribbon with vba

nucliabrasil
Advocate

Create ribbon with vba

nucliabrasil
Advocate
Advocate

Hi !

 

Is it possible ?

 

Thanks

0 Likes
Reply
608 Views
3 Replies
Replies (3)

bradeneuropeArthur
Mentor
Mentor

Please explain a little more what you need, because a/the ribbon is always there.

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes

JhoelForshav
Mentor
Mentor

Hi @nucliabrasil 

 

Do you want to create a new ribbon tab?

Here is an example i made in iLogic. Should be easy to rewrite as VBA code.

 

Class ThisRule
Sub Main

            ' Get the assembly ribbon.
            Dim AssemblyRibbon As Ribbon = ThisApplication.UserInterfaceManager.Ribbons.Item("Assembly")

            ' Create a new tab.
            Dim oTab As RibbonTab = AssemblyRibbon.RibbonTabs.Add("New Tab", "id_newTab", Guid.NewGuid().ToString())

            ' Create a new panel.
            Dim oPanel As RibbonPanel = oTab.RibbonPanels.Add("New Panel", "id_newPanel", Guid.NewGuid().ToString())


 Dim controlDefs As Inventor.ControlDefinitions = ThisApplication.CommandManager.ControlDefinitions
            Dim m_sampleButton As ButtonDefinition = controlDefs.AddButtonDefinition("Button", "oButton", CommandTypesEnum.kShapeEditCmdType)


            ' Add a button.
            oPanel.CommandControls.AddButton(m_sampleButton, True)
	End Sub
	   
 End Class
  

 This should really be done in an AddIn but you can do it this way

JhoelForshav
Mentor
Mentor

The code i posted creates a tab in the assembly environment. So if you run it from within a part you won't see the tab appear. I'm sure you can tell by the code but I might as well mention it 🙂

0 Likes