Returning an Object from a Collection

Microsoft Graph Visual Basic

Returning an Object from a Collection

   

The Item method returns a single object from a collection. The following example sets the firstEntry variable to a LegendEntry object that represents the first legend entry.

Set firstEntry = myChart.Legend.LegendEntries.Item(1)

The Item method is the default method for most collections, so you can write the same statement more concisely by omitting the Item keyword.

Set firstEntry = myChart.Legend.LegendEntries(1)

For more information about a specific collection, see the Help topic for that collection.