How to extract configation name of a selected view with Macro ?

Hello,

I’m looking for a macro capable of retrieving the name of the configuration used on a view previously selected by the user in a solidworks drawing.

Thanks for your help.

A view must be selected before you run the following macro

Option Explicit
Sub main()
    Dim swApp As SldWorks.SldWorks
    Dim swModel As SldWorks.ModelDoc2
    Dim swSelMgr As SldWorks.SelectionMgr
    Dim swView As SldWorks.View
    Dim bRet As Boolean    
    
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swSelMgr = swModel.SelectionManager
    Set swView = swSelMgr.GetSelectedObject6(1, -1)
    
    Debug.Print swView.ReferencedConfiguration
   
End Sub