Delete function with vba

Hello:) 

I'm looking for a function that allows me to delete only "my function" and not the child functions.

Approach N°1)

Sub main()

Set swApp = _
Application.SldWorks

Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("Enlèv. mat.-Extru.2", "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
Part.EditDelete
End Sub

 So I used it with a condition 

If (Sheets("BD_Valeur").Range("D154")) = True Then

boolstatus = Part.Extension.SelectByID2((Sheets("BD_Valeur").Range("B154")), "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)

Part.EditDelete

End If

 

All this works very well but: 

He removed the function with the box checked.

 

Do you have a corresponding function?

Or do you know if I need to modify a variable??

 

boolstatus = Part.Extension.DeleteSelection2(0)

 

Solved after a lot of research:)

1 Like