Macro Fix/Float and reselect the components

Hi there,

the funvtion of floating and fixing a component deselects everything after the operation. I would like to reselect the components.

But I just do not know how to use the Selection list. After some reading I got it running with reselecting at least one or the first selected component.

There are a few probably unnecessary remains within the definition...

How do I fill and reselect the selection list? Can anyone help me?

Sub main()

Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swComp As SldWorks.Component2

Dim swSelMgr As SldWorks.SelectionMgr

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc

Set SelMgr = Part.SelectionManager

Set swModel = swApp.ActiveDoc

Set swSelMgr = swModel.SelectionManager

Set swComp = swSelMgr.GetSelectedObjectsComponent2(1)

Part.UnfixComponent

swComp.Select4 True, Nothing, True

End Sub

SolidworksApi/macros