• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

VBA Scripting for Illustrator: Open page of multi page PDF file

New Here ,
Jun 12, 2018 Jun 12, 2018

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

TOPICS
Scripting

Views

1.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jun 13, 2018 Jun 13, 2018

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 13, 2018 Jun 13, 2018

Copy link to clipboard

Copied

incidentally if you don't already have the reference it can be found here:

Illustrator Scripting | Adobe Developer Connection

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 13, 2018 Jun 13, 2018

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"

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 13, 2018 Jun 13, 2018

Copy link to clipboard

Copied

LATEST

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines