Get component name with VBA

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?

Reply to
hvdstroet
Loading thread data ...

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-

Reply to
Heikki Leivo

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.