This is my first discussion so please forgive the unfamiliar and my poor english.
Because I'm Japanease.
My question is How do I get component name by selectionmanager When activedoc is drawing.
I want to get component name selected object on drawing.
The code I made before works well When activedoc is assembly.
But it dose not run When activedoc is drawing.
Here is my code
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swComp As SldWorks.Component2
Dim bRet As Boolean
Dim strName As String
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set swComp = swSelMgr.GetSelectedObjectsComponent2(1)
strName = swComp.Name2