Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Need help geeting started. Add macros to quick access toolbar

1 REPLY 1
Reply
Message 1 of 2
BennyDS
448 Views, 1 Reply

Need help geeting started. Add macros to quick access toolbar

Hi

 

We have a problem at work with buttons disappearing from the quick access toolbar.

I already looked around and it is being said that it is a bug, wich can be fixed with a service pack. I work in a big company, and they are refusing to do the service pack.

 

So the next best thing I can figure is to make a macro, wich will add all the macros I want to the quick access toolbar in assembly level, part level, sketch level and drawing level.


But I have no idea how to start this.

Any tips are welcome.

 

Thank you

1 REPLY 1
Message 2 of 2
adam.nagy
in reply to: BennyDS

Hi there,

 

It would be possible to go through all the VBA macros and then add them like that, but this should help too I hope:

>>>>>

Sub AddMacros() 
' List of Macros we want to add
Dim macros(1) As String
macros(0) = "Module2.qwe"
macros(1) = "Module1.test"

Dim cds As ControlDefinitions
Set cds = ThisApplication.CommandManager.ControlDefinitions
Dim ribbons As ribbons
Set ribbons = ThisApplication.UserInterfaceManager.ribbons

Dim macro As Variant
For Each macro In macros
' Check if there is already a ControlDefinition for it
Dim cd As ControlDefinition
For Each cd In cds
If TypeOf cd Is MacroControlDefinition And InStr(1, cd.InternalName, macro) > 0 Then
Exit For
End If
Next

' Add it if not
If cd Is Nothing Then
Set cd = cds.AddMacroControlDefinition(macro)
End If

Dim ribbon As ribbon
For Each ribbon In ribbons
' Check if QAT already contains it
Dim cc As CommandControl
For Each cc In ribbon.QuickAccessControls
If cc.ControlDefinition Is cd Then
Exit For
End If
Next

' Add it if not
If cc Is Nothing Then
Set cc = ribbon.QuickAccessControls.AddMacro(cd)
End If
Next
Next
End Sub

<<<<<

 

Cheers,



Adam Nagy
Autodesk Platform Services

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report