Reputation: 21
I need to download content of .pdf documents programmatically using vba run from Excel. I have an Adobe Acrobat Pro licence which provides libraries to Excel so one is able to work with .pdf documents using vba in Excel. I can very well extract data from text fields using jso.getField:
Dim AcroApp As Acrobat.CAcroApp
Dim theForm As Acrobat.CAcroPDDoc
Dim jso As Object
Dim text1 As String
Set AcroApp = CreateObject("AcroExch.App")
Set theForm = CreateObject("AcroExch.PDDoc")
theForm.Open ("C:\Users\....path…\file.pdf")
Set jso = theForm.GetJSObject
text1 = jso.getField("fill_1").Value
…unfortunately there are also radiobuttnos in the .pdf files which I don’t know how to access and retrieve it’s values. All the text fields can be referenced easily with e.g. “fill_1” whereas the radiobuttons are structured like Group1 -> Value1 ->Value2.
I also need to access radiobutton values, without that I am a bit stack :(.
Thank you very much for any advice
Jan
Upvotes: 1
Views: 512
Reputation: 139
Let's assume there is a group of 3 radio buttons in the PDF form called "My_Options". Each option is named as follows
To ask which button is selected in VBA:
dim Text as string
Text = jso.getField("My_Options").Value
This returns Text = "Option_2"
To set "Option_3" as selected in VBA:
jso.getField("My_Options").Value = "Option_3"
Upvotes: 0