Navigating ActiveX collections
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Navigating ActiveX collections
ActiveX collections are COM objects that reference multiple instances of a particular class of COM object. ABL supports collection navigation by allowing you to access a COM object through the indexed Item property of the collection object. For example:
|
In this example, ABL loops through all the worksheet objects
in the Excel Application collection. Sheets is the collection and Item is
the indexed property that returns the component handle to each Sheet
object. The code uses the index (i) to loop through the total number
of Sheet objects in the collection (ExcelApp:Sheets:Count() ),
and assigns a unique name to each one ("ABC1", "ABC2", and so on).
Note: Collections are often named as a plural of the
object class that they index. Thus, in this example, Sheets is the
collection class and Sheet is the object class whose instances are
indexed by the Item property of Sheets.