how to show in the message box the assembly name or part name in the model browser without selecting it using vba?
thanks
Solved! Go to Solution.
Solved by jdkriek. Go to Solution.
Several ways to do this, just depends on what you are using it for
Public Sub NameThat() Dim oAssDoc As AssemblyDocument Set oAssDoc = ThisApplication.ActiveDocument Dim oAssDef As AssemblyComponentDefinition Set oAssDef = oAssDoc.ComponentDefinition Dim oOccurrence As ComponentOccurrence For Each oOccurrence In oAssDef.Occurrences sName = Split(oOccurrence.Name, ":") MsgBox (sName(0) & " in " & oAssDoc.DisplayName) Next End Sub
quick question >>> jd
ive finished my macro , tested it and works perfectly.
but after ive added it to our default vba project and after making a button, and accessing the macro from the button,
it stop working ! sometimes it works but it process so slow like its frozen and i have to hit esc to exit.
what do i have to check to fix this.
Msgboxs halt all processes until it is dismissed, so if you have a lot of parts in your assembly it might be hanging. I usually write the results to a .txt file for large assemblies or just simply use debug.print and watch the "Immediate" window inside the VBA editor.