Copy link to clipboard
Copied
I'm writing a VBA script to automate the editing of some ~600 pdf files.
I declared my illustrator application object as iapp.
I can open the file I want to edit using: iapp.Open(filePath), but that triggers Illustrator to open a dialog box asking me which page of the PDF I want to open.
How do I:
a. open a specific page of the PDF using VBA
b. use VBA to press OK on the dialog box
Copy link to clipboard
Copied
There's a PageToOpen propertly listed in the scripting reference that it looks like you could use. the document gives this example:
'Opens a multi-page PDF file to a specific
'page using the PDFFileOptions object
'filePath contains the full name and file path of the file to open
Sub pdfFileOptions(filePath)
Set appRef = CreateObject("Illustrator.Application")
With appRef.Preferences.PDFFileOptions
.PageToOpen = 2
.PDFCropToBox = 5 'aiPDFBoundingBox
End With
Set docRef = appRef.Open(filePath, 1)
End Sub
Copy link to clipboard
Copied
incidentally if you don't already have the reference it can be found here:
Copy link to clipboard
Copied
Ok, I finally got it working. In addition to the code you posted you need to add the line:
appRef.UserInteractionLevel = aiDontDisplayAlerts
Otherwise it throws some bullshit error about "unkown open setting"
Copy link to clipboard
Copied
[ moved from Illustrator to Illustrator Scripting ]