Macro solidworks - Removal of multiple sheets

Hello

I'm trying to delete multiple sheets at once. To do this, I would like to select several sheets and then run the delete function.

The problem is that I can't select several sheets.

Any idea on how to get there?

For i = 0 To UBound(vSheetName)
        sheetName = vSheetName(i)
        Debug.Print "Nom de feuille:" & sheetName
        If sheetName Like "*" & suffix & "*" Then
            Debug.Print "On entre dans la partie suppression"           
            'Supression des feuilles Sym
            bRet = swModel.Extension.SelectByID2(sheetName, "SHEET", 0, 0, 0, False, 0, Nothing, 0)

        End If
Next i
'Suppression des feuilles
bRet = swModel.Extension.DeleteSelection2(0)

 

Hello

You should change the False to True in:

bRet = swModel.Extension.SelectByID2(SheetName, "SHEET", 0, 0, 0, True, 0, Nothing, 0)

Kind regards

2 Likes

It's so simple when you have the answer...

Thank you @d.roger 

1 Like