Here is the updated macro:
Dim swApp As SldWorks.SldWorks
Dim swModel As ModelDoc2
Dim swSelMgr As SelectionMgr
Dim swSketchLine As SketchLine
Dim SketchLineID As Variant
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set swSketchLine = swSelMgr.GetSelectedObject6(1, -1)
SketchLineID = swSketchLine.GetID
MsgBox "Line" & SketchLineID(1)
Wow, that's very simple. Thanks a lot!
Thanks a lot, but the problem is now solved
I mentioned my macro because it gets the fully qualified path name, not just the entity name. Big difference, especially when working with IModelDocExtension::SelectByID2.