Remove Method (ActiveX)

Removes a named object from the dictionary.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.Remove(Name)
object

Type: Dictionary

The object this method applies to.

Name

Access: Input-only

Type: String

The name (keyword) of the object to be removed from the dictionary.

Return Value (RetVal)

Type: Object

The object being removed from the dictionary.

Remarks

For example, removing the object with the name "FirstKeyword" from the following dictionary:

Results in the following dictionary:

Examples

VBA:

Sub Example_Remove()
    ' This example creates a dictionary and adds
    ' a custom object to that dictionary. It then
    ' removes the object from the dictionary.
    
    Dim dictObj As AcadDictionary
    Set dictObj = ThisDrawing.Dictionaries.Add("TEST_DICTIONARY")
    
    ' Load the ObjectARX application that defines the custom object.
    ' Note: The application listed here does not exist and
    ' will cause an error when run. Change the application name
    ' to the path and name of your ObjectARX Application.
    ThisDrawing.Application.LoadArx "MyARXApp.arx"
    
    ' Create the custom object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadObject
    
    keyName = "OBJ1"
    className = "CAsdkDictObject"
    
    Set customObj = dictObj.AddObject(keyName, className)
    
    ' Remove the object from the dictionary using the keyName
    dictObj.Remove keyName
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Remove()
    ;; This example creates a dictionary and adds
    ;; a custom object to that dictionary. It then
    ;; removes the object from the dictionary.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq dictionaries (vla-get-Dictionaries doc))
  
    (setq dictObj (vla-Add dictionaries "TEST_DICTIONARY"))
    
    ;; Load the ObjectARX application that defines the custom object.
    ;; Note: The application listed here does not exist and
    ;; will cause an error when run. Change the application name
    ;; to the path and name of your ObjectARX Application.
    (vla-LoadArx acadObj "MyARXApp.arx")
    
    ;; Create the custom object in the dictionary
    (setq keyName "OBJ1")
    (setq className "CAsdkDictObject")
    
    (setq customObj (vla-AddObject dictObj keyName className))
    
    ;; Remove the object from the dictionary using the keyName
    (vla-Remove dictObj keyName)
)