Use VBA to Create Bookmark to Execute a Menu Item (Open File)

New Here ,
Aug 05, 2018 Aug 05, 2018

Copy link to clipboard

Copied

Hi

I am designing an Access Database that combines a number of PDF documents and adds a set of bookmarks to various locations in the document , and also to a number of files and / or folder external to the PDF document. Currently I using VBA to open the PDF object and create the set of bookmarks, which for the most part work fine, however the are some issues:  some of the linked JPG or other graphic files open in a browser  (not the associated graphics program) or not at all  (The cause is not a file association issue).  Oddly, the resulting PDF will work correctly with some PDF readers and/or versions of Acrobat. but not in others.

I have included some of the code below which should explain what I am doing:-

     'Late Binding

    Set gApp = CreateObject("AcroExch.App")

    Set gPDDoc = CreateObject("AcroExch.PDDoc") 

......

    If gPDDoc.Open(sTargetPDFPath) Then

Set jso = gPDDoc.GetJSObject

Set BMR = jso.BookMarkRoot

BMR.createChild "My DOCUMENTS", "", 0

BMR.createChild "SUB HEADING 1", "", 1

     ... etc...

Then I iterate though some DB records to retrieve file paths and create the Java script  App.LaunchURL call which is added to the bookmark  

  sPath = RSLvl!ExhibitBMPath        '(Get file/folder Path from DB)

  sBMName = RSLvl![Bmk_Name]   '(Get Bookmark Text to display)

  bmcChldLv2.createChild sBMName, "app.launchURL('" & sPath & "', true)", PositionIndex     '(Create and insert the Bookmark)

What I would like to do instead of using the app.launchURL code option (which I believe is the likely cause of the intermittent issues I am having)  is to use the   'Execute a Menu Item'  > 'Open File'  and/or 'Execute a Menu Item'  > 'Open Folder'   (naturally providing the path to the relevant file/folder.)  which are options available when you are manually creating bookmarks in Acrobat.   

(All bookmark create manually with the Execute Menu Item option (open file / Open Folder) to the same file/folder paths inserted by the database work as expected.)

I have googled for days and days, read an re-read the SDK and numerous other on-line publications and bits and pieces, which was all helpful and helped me with what I already have, but for the life of me I can not workout how to build the bookmark to Execute a Menu Item (rather than App.LaunchURL)

An assistance or advice would be greatly appreciated.

Thank you.

TOPICS
Acrobat SDK and JavaScript

Views

454

Likes

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

correct answers 1 Correct Answer

Most Valuable Participant , Aug 05, 2018 Aug 05, 2018
Not available.

Likes

Translate

Translate
Most Valuable Participant ,
Aug 05, 2018 Aug 05, 2018

Copy link to clipboard

Copied

LATEST

Not available.

Likes

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