About Creating a Selection Set (VBA/ActiveX)

To create a named selection set, use the Add method. This method requires only a single parameter—the name of the selection set.

If a selection set of the same name already exists, AutoCAD returns an error message. It is a good programming practice to delete a selection set when you no longer need it. Use the Delete method to delete a selection set, as in the following example:

ThisDrawing.SelectionSets.Item("NewSelectionSet").Delete

Create an empty selection set

This example creates a new selection set.

Sub Ch4_CreateSelectionSet()
  Dim selectionSet1 As AcadSelectionSet
  Set selectionSet1 = ThisDrawing.SelectionSets.Add("NewSelectionSet")
End Sub