Communicating between Acrobat and VBA

Community Beginner ,
Jan 10, 2018 Jan 10, 2018

Copy link to clipboard

Copied

Hello,

Can someone please redirect me to an example or documentation to call a VBA Script within Javascript. I would like to set up such that when you press a button on the Acrobat pdf file it runs the VBA code.

I would like to send a string of data from a text field in Acrobat into my VBA code and then return the result (text string) of my vba code back into acrobat pro.

Please advise!

TOPICS
Acrobat SDK and JavaScript, Windows

Views

581

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

Adobe Community Professional , Jan 11, 2018 Jan 11, 2018
Again... you can't "send" anything "over to" the VBA application. The VBA application needs to reach into Acrobat and get it then push the results into Acrobat as well. Check out the documentation for using the JavaScript Object from VBA. That will get you started.Acrobat DC SDK Documentation 

Likes

Translate

Translate
Adobe Community Professional ,
Jan 10, 2018 Jan 10, 2018

Copy link to clipboard

Copied

You cannot call a VBA script from JavaScript. Acrobat's JavaScript runs in a "sand box" and there is almost no way to interact with something that is outside of Acrobat.

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
Adobe Community Professional ,
Jan 10, 2018 Jan 10, 2018

Copy link to clipboard

Copied

Karl is correct. However, there are tricks you can play.

You can use VBA to query Acrobat for the existence of an object (a variable or field value) at a fairly frequent interval, every quarter second for example. Pressing the button in Acrobat would create the object the VBA code is looking for and set it's value. At the next interval, your VBA code sees the object, gets the value, then runs whatever other code you want and pushes the result back to the PDF and deletes the object.

You'd need to have Acrobat and the application running the VBA running at the same time.

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
Community Beginner ,
Jan 11, 2018 Jan 11, 2018

Copy link to clipboard

Copied

Thanks for your reply Joel.

I have created the string in Acrobat that I would like to send over to VBA. How would i send this string to VBA?  Similarly in VBA how would i send the result back into Acrobat?

Can you please direct me to some documentation.

Thanks

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
Adobe Community Professional ,
Jan 11, 2018 Jan 11, 2018

Copy link to clipboard

Copied

Again... you can't "send" anything "over to" the VBA application. The VBA application needs to reach into Acrobat and get it then push the results into Acrobat as well. Check out the documentation for using the JavaScript Object from VBA. That will get you started.

Acrobat DC SDK Documentation 

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
Community Beginner ,
Jan 17, 2018 Jan 17, 2018

Copy link to clipboard

Copied

LATEST

Joel,

Thanks for directing me the right way. I also found this article (Reading And Modifying PDF Form Fields with VBA - KHKonsulting LLC ) which was great help .

What worked for me was creating a VB application that reads a field in an acrobat form and then sends a calculated value back to acrobat.

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