AnsweredAssumed Answered

About “None of the selected entities could be deleted”

Question asked by Wataru Abe on Jun 2, 2019
Latest reply on Jun 3, 2019 by Ivana Kolin

Hel me beginners with both SolidWorks & API

 

I recoded the “Delete specific part” operation in SoldWorks Macro, and created code that can be operated in Excel.

—————————————————————————

 

Option Explicit

 

Dim swApp As Object

Dim Part As Object

Dim boolstatus As Boolean

 

Sub main()

 

Set swApp = CreateObject(“SldWorks.Application”)

Set Part = swApp.ActiveDoc

 

boolstatus = Part.Extension.SelectByID2(“1_BASE_PLATE@CAD/collor_7-9-1@1_BASE_PLATE”,”COMPONENT”,0,0,0,False,0,Nothing,0)

Part.EditDelete

 

End Sub

 

——————————————————————————

Next,I wrote collor_7-9-1 in Excel Range(“A1”) and rewritten the code as follows

 

——————————————————————————

Option Explicit

 

Dim swApp As Object

Dim Part As Object

Dim boolstatus As Boolean

Dim test

 

Set swApp = CreateObject(“SldWorks.Application”)

Set Part = swApp.ActiveDoc

 

Dim test

test = Range(“A1”).Value

 

boolstatus = Part.Extension.SelectByID2(“1_BASE_PLATE@CAD/test@1_BASE_PLATE”,”COMPONENT”,0,0,0,False,0,Nothing,0)

Part.EditDelete

 

End Sub

 

—————————————————————————

Then, the message “None of the selected entities could be deleted” appears and the part can not be deleted

 

How should I do it? 

Outcomes