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:
DEFINE VARIABLE ix AS INTEGER NO-UNDO.
DEFINE VARIABLE ExcelApp AS COM-HANDLE NO-UNDO.
/* Instantiate Automation object for Excel.Application in ExcelApp */
CREATE "Excel.Application" ExcelApp.
. . .
REPEAT ix = 1 TO ExcelApp:Sheets:Count():
ExcelApp:Sheets:Item(ix):Name = "ABC" + STRING(ix).
END.
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.