Skip to main content
Known Participant
January 10, 2018
Answered

Communicating between Acrobat and VBA

  • January 10, 2018
  • 2 replies
  • 3698 views

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!

This topic has been closed for replies.
Correct answer Joel Geraci

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 

2 replies

Joel Geraci
Community Expert
Community Expert
January 11, 2018

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.

Known Participant
January 11, 2018

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

Joel Geraci
Community Expert
Joel GeraciCommunity ExpertCorrect answer
Community Expert
January 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 

Karl Heinz  Kremer
Community Expert
Community Expert
January 10, 2018

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.