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: 

name to show in vba code

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
akosi
480 Views, 7 Replies

name to show in vba code

how to show in the message box the assembly name or part name in the model browser without selecting it using vba?

 

thanks

7 REPLIES 7
Message 2 of 8
jdkriek
in reply to: akosi

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
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 3 of 8
akosi
in reply to: jdkriek

thanks!!!Smiley Happy

Message 4 of 8
jdkriek
in reply to: akosi

You're welcome 😉

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 5 of 8
akosi
in reply to: jdkriek

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.

 

 

Message 6 of 8
jdkriek
in reply to: akosi

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.

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 7 of 8
akosi
in reply to: jdkriek

i dont understand.

 

what is it do , if i make it write to a text file or immediate window?

Message 8 of 8
jdkriek
in reply to: akosi

It stops it from hanging usually, again Msgbox stops the program untill you click it.

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


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

Post to forums  

Autodesk Design & Make Report