Copy link to clipboard
Copied
Hi
I am designing an Access Database that combines a number of PDF documents and then adds a set of bookmarks to various locations locations within the document and also to some external files/folders. Currently I using VBA to open the PDF object and create a set of bookmarks, which for the most part work fine, however the are some issues with windows opening files in a browser, or not at all (It is not a file association issue).
I have included some of the code below which should explain what I am
Set gApp = CreateObject("AcroExch.App")
Set gPDDoc = CreateObject("AcroExch.PDDoc") 'Set gAVDoc = CreateObject("AcroExch.AVDoc")
......
If gPDDoc.Open(sTargetPDFPath) Then
Set jso = gPDDoc.GetJSObject
Set BMR = jso.BookMarkRoot
BMR.createChild "BRIEF DOCUMENTS", "", 0
BMR.createChild "WITNESSES", "", 1
... etc...
The next part iterates though some records to retrieve file paths and creates Java script App.LaunchURL call which is added in the bookmark (see following)
sPath = RSLvl!ExhibitBMPath
sBMName = RSLvl![Bmk_Name]
bmcChldLv2.createChild sBMName, "app.launchURL('" & sPath & "', true)", PositionIndex
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 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.
I have googled for days and days, read an re-read the SDK and numerous other publications, 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.
An assistance or advice would be greatly appreciated.
Thank you.
Copy link to clipboard
Copied
JavaScript on its own can't do it. You can use the openDoc method of the app object, though.
If you want to use the "Open a File" command (I'm not aware of an "Open a Folder" command), you should ask over at the Acrobat SDK forum.