Examples: ID property

The following procedure runs when the user clicks a button in a VBA user form. The procedure loops through the collection named Item Info and checks the Item Color property for each item. If the value is Red, the collection’s Remove method deletes the object indicated by the ID property:

Private Sub CommandButton_Click()
	Dim ItemCollection As DUOSObjects
	Dim ItemObject As DUOSObject

	Set ItemCollection = DUOSObjectsGet("Item Info")
	For Each ItemObject In ItemCollection
		If ItemObject.Properties.Item("Item Color") = "Red" Then
		'Delete the object
			ItemCollection.Remove (ItemObject.ID)
		End If
End Sub

Documentation Feedback