I am trying to get a simple macro working in SW 2006. What I need is a message box which returns the selected component name. Which command do I use to get the name of an assembly component?
Get component name with VBA
Aug 08, 2006
1 Replies
Have you tried the most obvious one, Name? :-?
For example,
dim modelDoc as SldWorks.ModelDoc2 Set modelDoc = swApp.ActiveDoc
Dim component as SldWorks.Component2 Set component = modelDoc.SelectionManager.GetSelectedObject(1)
MsgBox component.Name
Or
MsgBox component.Name2
I recommend you to read the API help in SolidWorks Help menu.
-h-
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required