Index property
Gets the ordinal position of an object in a collection.
Version added
2.0
Syntax
| |
intRet |
Integer or Long. The index of the object within its collection. See Remarks for return data type information. |
object |
Required. An expression that returns an object in the Applies to list. |
Remarks
Object |
Return data type |
Addon, Document, Event, Font, Layer, Master, MasterShortcut, Row, Section, Window |
Integer |
Color, Connect, Menu, MenuItem, Shape, Style, Toolbar, ToolbarItem |
Long |
Most collections are indexed starting with 1 rather than zero (0), so the index of the first element is 1, the index of the second element is 2, and so forth. The index of the last element in a collection is the same as the value of that collection's Count property. You can iterate through a collection by using these index values. Adding objects to or deleting objects from a collection can change the index values of other objects in the collection.
There are some exceptions. The Color collection is indexed starting with 0. This is consistent with the numbering displayed next to the colors that appear in the Color Palette dialog box (click Color Palette on the Tools menu).
These collections are also indexed starting with 0: AccelItems, AccelTables, MenuSets, MenuItems, Menus, ToolbarItems, Toolbars, and ToolbarSets.