The Grapher object hierarchy includes several collection objects. Although these collections contain different types of data, they can be processed using similar techniques.
All collection objects have a read-only property named Count that gives the number of objects in the collection.
Every collection also has a method called Item that retrieves one of the objects contained in the collection. The Item method accepts a single argument specifying either an index number or (for most collections) the name of the object to retrieve. An index number is a value between one and the value returned from the collection's Count property. The name used to identify items is typically the object ID (for example, "Bar Chart 1" or "X Axis 1").
Many objects have one or more Add methods for creating new items and adding them to the collection. For example, to add a rectangle to the AutoShapes collection, you would use the AddRectangle method:
Shapes.AddRectangle(2, 2, 4, 4)
The objects contained by collections are automatically removed when the contained object is deleted or closed. For example, call a Document object's Close method to close a document or call the AutoShape object's Delete method to remove any AutoShape-derived object.
Every automation object provides a Parent and an Application property. The Application property returns a reference to the top-level Application object. This is a convenient way to access the Application object, particularly when passing automation objects as arguments to subroutine and function calls.
The Parent property returns a reference to the collection object that an object is contained in, or the controlling object. If an object is not contained by a collection object, the Parent property typically returns a reference to the Application object.
Grapher Object Model
Methods and Properties
Overview of Grapher Objects