DeleteObject

<< Click to Display Table of Contents >>

 

DeleteObject

DeleteObject(ChildName)

Erases the specified object from a project. The ChildName parameter is a String (ignores capitalization) that indicates the child object to delete. This method returns True if the operation to delete an object was successful, or False in case the child object does not exist.

To delete an object from a reference to an element, use this method in the parent object. The next script contains an example of using this method.

Sub CommandButton1_Click()
  Set obj = Application.GetObject("Data")
  If obj.DeleteObject("Tag001") Then
    MsgBox("Tag successfully deleted!")
  Else
    MsgBox("Deleting failed: Tag does not exist.")
  End If
End Sub

 

NOTE

Only objects with an Insert option on their contextual menu can use this method.

Was this page useful?