Renommer des jeux de sélections en VBA

Bonjour.
J’ai une macro qui crée des jeu de sélections mais je souhaite les renommer en automatique pour standardiser le contenu de la pièce.

Voici un extrait de macro qui donne le nom des jeux de sélection mais je n’arrive pas à écrire le code pour les renommer…

"Sub TraverseFeatureFeatures(swFeat As SldWorks.Feature, swModel As SldWorks.ModelDoc2)
Dim swSelectionSetFolder As SldWorks.SelectionSetFolder
Dim selectionSetArray As Variant
Dim selectionSetItemArray As Variant
Dim selectionSetItemArrayTypes As Variant
Dim swSelectionSet As SldWorks.SelectionSet
Dim swSelectionSetItem As SldWorks.SelectionSetItem
Dim swFace As SldWorks.Face2
Dim swEdge As SldWorks.Edge
Dim swBody As SldWorks.Body2
Dim i As Long
Dim j As Long
Dim ret As Boolean

While Not swFeat Is Nothing
    If swFeat.Name = "Selection Sets" Then
        Debug.Print "    " & swFeat.Name & " [" & swFeat.GetTypeName & "]"
        'Get Selection Sets folder
        Set swSelectionSetFolder = swFeat.GetSpecificFeature2
        'Get selection sets in Selection Sets folder
        selectionSetArray = swSelectionSetFolder.GetSelectionSets
        For i = 0 To UBound(selectionSetArray)
            Set swSelectionSet = selectionSetArray(i)
            Debug.Print "      Selection set[" & i & "] name: " & swSelectionSet.GetName
            'Get the items and their types in this selection set
            selectionSetItemArray = swSelectionSet.GetSelectionSetItems
            selectionSetItemArrayTypes = swSelectionSet.GetSelectionSetItemTypes
            For j = 0 To UBound(selectionSetItemArray)
                Set swSelectionSetItem = selectionSetItemArray(j)
                Select Case selectionSetItemArrayTypes(j)
                    Case swSelectType_e.swSelFACES
                        'Get the Dispatch object for the selection set item
                        Set swFace = swSelectionSetItem.GetCorrespondingItem
                        'Get the name of the body for the face
                        Set swBody = swFace.GetBody
                        Debug.Print "        Name of face[" & j & "]'s body: " & swBody.Name
                    Case swSelectType_e.swSelEDGES
                        'Get the Dispatch object for the selection set item
                        Set swEdge = swSelectionSetItem.GetCorrespondingItem
                        'Get the name of the body for the edge
                        Set swBody = swEdge.GetBody
                        Debug.Print "        Name of edge[" & j & "]'s body: " & swBody.Name
                    End Select
            Next
        Next
    End If
    Set swFeat = swFeat.GetNextFeature
Wend

End Sub"

Merci d’avance

Bonjour;

Il ne me semble pas que cela soit faisable dans l’immédiat.
Voir demande d’amélioration ci dessous:

Voir aussi exemple de création/suppression de Jeu de sélection…il ne semble pas possible de modifier leur Nom. mais il est probablement possible de recréer un nouveau Jeu…
https://help.solidworks.com/2018/english/api/sldworksapi/Create_and_Delete_Selection_Sets_Example_VB.htm