AutoShapes Collection
Within automation, graphic drawing and graph objects are called shapes. The AutoShapes collection contains all of the drawing and graph objects in a document. This object is also used to create new shapes and add them to the collection. There is a unique method to create each type of shape. Methods exist to enumerate all the shapes in the collection, add objects to the AutoSelection collection, and create new drawing and graph shapes.
Properties
Methods
Example
The following script demonstrates how the AutoShapes collection is used.
Sub Main
'Declares GrapherApp as an object
Dim GrapherApp As Object
'Creates an instance of the Grapher Application object
'and assigns it to the variable named "GrapherApp"
Set GrapherApp = CreateObject("Grapher.Application")
'Make Grapher visible
GrapherApp.Visible = True
'Declare Docs as Object
Dim Docs As Object
'Assigns the Documents collection to
'the variable named "Docs"
Set Docs = GrapherApp.Documents
'Declare Plot as Object
Dim Plot As Object
'Creates a new plot window
Set Plot = Docs.Add(grfPlotDoc)
'Declares Shapes as an object
Dim Shapes as Object
'Assigns the AutoShapes collection to
'the variable named "Shapes"
Set Shapes = Plot.Shapes
End Sub