how to aply to all opened files

here is my macro's code (set a layer to visible/invisible).

I would like to set the code to apply changes to all opened file instead of the active file

can somebody help me with that

thanks a lot...

Dim swApp As Object
'------------------------------------
' Preconditions:
'          (1) Drawing document is open.
'          (2) Drawing document contains a layer named PROTO.
'

' Postconditions:
'          If PROTO layer is visible, then it becomes not visible.
'             - or -
'          If PROTO layer is not visible, then it becomes visible.
'
'------------------------------------------------------------------
Option Explicit

Sub main()

    Dim swApp                       As SldWorks.SldWorks

    Dim swModel                     As SldWorks.ModelDoc2

    Dim swLayerMgr                  As SldWorks.LayerMgr

    Dim swLayer                     As SldWorks.Layer

  

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    Set swLayerMgr = swModel.GetLayerManager

    Set swLayer = swLayerMgr.GetLayer("PROTO")

      

    If swLayer.Visible = False Then

        ' Toggle layer on

        swLayer.Visible = True

        Debug.Assert True = swLayer.Visible

    Else

        ' Toggle layer off

        swLayer.Visible = False

        Debug.Assert False = swLayer.Visible

    End If

End Sub

SolidworksApi macros