The Documents collection provides access to the Grapher file menu commands. Use the Documents collection Open method to open an existing plot or worksheet. Use the Add method to create a blank plot or worksheet. The SaveAll method saves all open documents and the CloseAll method closes all open documents. To close an individual document, use the Documents collection Close method.
The following script demonstrates how the Documents collection is used.
'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")
'Makes Grapher visible
GrapherApp.Visible = True
'Declares Docs as an object
Dim Docs As Object
'Assigns the Documents collection to
'the variable named "Docs"
Set Docs = GrapherApp.Documents