Add pages to a Grapher project with a predefined page size via automation

Grapher 14 added the ability to create multi-page project files, however all added pages are letter size with portrait orientation. If you wish to create a project with many pages and want those pages to all be a specific predefined size, you can use the script below to create the project, and then you can add content to each page. If you would like the pages to be a custom page size, see How can I add pages to my Grapher project with a custom page size?.


To run the script:

  1. Copy the script below.
  2. Open Grapher and turn on the Script Manager by clicking View | Display | Script Manager.
  3. Press Ctrl+A to select all of the existing lines in the Script Manager and then press DELETE.
  4. Press Ctrl+V to paste it into the Script Manager.
  5. Click the green arrow Start/Resume icon in the Script Manager.


Sub Main

'Create Grapher as an Object
Dim Grapher As Object
Set Grapher = CreateObject("Grapher.Application")
Grapher.Visible = True

'User defined variables
numpages = 3
outpath = "C:\temp\"
outfilename = "Plot1.gpj"
psize = grfLegal
porient = grfLandscape

'Set up page 1
Set Plot1 = Grapher.Documents.Add(grfPlotDoc)
Plot1.PageSetup.pageSize = psize
Plot1.PageSetup.Orientation = porient

'Add any additional pages and set them up
For i=2 To numpages
	Plot1.PageSetup.pageSize = psize
	Plot1.PageSetup.Orientation = porient

'Activate page 1

'Save the file

End Sub


Please contact us if you would like us to add your vote to our suggestion file for the ability to set a default page size to use for added pages.


Updated August 2019

Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.