Code: Select all
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swExt As SldWorks.ModelDocExtension
Dim swSelMgr As SldWorks.SelectionMgr
Dim swComp As SldWorks.Component2
Dim swAssem As SldWorks.AssemblyDoc
Dim featMgr As SldWorks.FeatureManager
Dim selMgr As SldWorks.SelectionMgr
Dim selComp As SldWorks.Component2
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swExt = swModel.Extension
Set swSelMgr = swModel.SelectionManager
Set featMgr = swModel.FeatureManager
Set swAssem = swModel
Set selComp = swAssem.GetSelectedMember
Dim d As String
Set d = selComp.Name
swApp.SendMsgToUser d
End Sub