Hide/show component

Hello,

Please take a look at the code below.  If you select a hidden component in the FM tree and run this, it does nothing.  However, if you change the True to False and select a shown component, it will successfully hide it!  This is just an example, ultimately I need to use this method to show particular components while I traverse the assembly.  (Which is why a simple swModel.HideComponent2 will not suffice.)  Any help is appreciated.

Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swComp As SldWorks.Component2

Sub main()
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swSelMgr = swModel.SelectionManager
    Set swComp = swSelMgr.GetSelectedObject6(1, -1)
   
        swComp.ISetVisibility True, swAllConfiguration, 1, ""    'better way

End Sub

SolidworksApi macros