Sub Main 'Declare the variable that references the application 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 'Assigns the Documents collection to the variable named "Docs" Set Docs = GrapherApp.Documents 'Open the worksheet Set Wks = Docs.Open("c:\golden\grapher4\samples\sample3.dat") 'Read the contents of a cell for text Text1 = Wks.Cells("A1") 'Read the contents of a cell for Y axis maximum value WksYMax = Wks.Cells("B20").Value 'Creates a new plot window and assign it to the variable named "Plot" Set Plot = Docs.Open(GrapherApp.Path+"\template\lineplot.grt",GrapherApp.Path+"\samples\sample3.dat") 'Add text read from the text string in the worksheet Plot.Shapes.AddText(3,6,Text1) 'Change the Y axis maximum based on the worksheet value Plot.Shapes.Item("Graph 1").Axes.Item("Y Axis 1").AutoMax = False Plot.Shapes.Item("Graph 1").Axes.Item("Y Axis 1").Max = WksYMax End Sub