This article contains a sample script for resizing an active graph.
To run this script:
- Click here to download the BAS file: Resize Graph.BAS
- Click Automation | Scripts | Run, select the BAS file from your downloads directory, and click Open.
- Copy the script below.
- Open Grapher and turn on the Script Manager by clicking View | Display | Script Manager.
- Press Ctrl+A to select all of the existing lines in the Script Manager and then press DELETE.
- Press Ctrl+V to paste it into the Script Manager.
- Click the Start/Resume icon (
) in the Script Manager.
'Resize selected objects Sub Main 'Create Grapher as an Object Dim Grapher As Object 'Start Grapher Set Grapher = CreateObject("Grapher.Application") Grapher.Visible = True 'Create a new document window Set Plot = Grapher.Documents.Active 'Set the Shapes object -- this will be used to count the number of objects later Set Shapes = Plot.Shapes 'Loop through all objects on the page looking for a graph For i = 1 To Shapes.Count If Shapes.Item(i).Type = 14 Then 'If it finds a graph, change the width and height 'To set a different size, change the numbers in () after .width and .height Shapes.Item(i).width(5) Shapes.Item(i).height(10) End If 'Go to next object Next i 'All graphs have now been changed End Sub
Updated October 17, 2018