I've used this code with Acrobat Pro 7 with no problems. Upgraded to Pro 9 and the pdf form field value assignment no longer works:
Set field2 = jso.Getfield("fieldA")
field2.Value = "abc"
There are no errors in vba or java console. I can read the pdf form field value wih no problem:
msgbox field2.Value
displays the pdf form field value in my vba application, (MS Access)
Are there any settings in Pro 9 that prevent writing to form fields through IAC?
Thanks in advance!
Hi,
with a standard acrobat form it works furtheron in 9.2. Pro.
HTH, Reinhard
Test.vbs
-------------------------------
'/ set objects for working with an active/opened doc
Set AcroApp = CreateObject("AcroExch.App")
Set AVDoc = AcroApp.GetActiveDoc
Set PDDoc = AVDoc.GetPDDoc
Set jso = PDDoc.GetJSObject
'/ get and set value
x = jso.getNthFieldName(6)
set f = jso.Getfield(x)
msgbox(f.Value)
f.value = "NewValue"
Dear ReinhardF,
Thanks for the information. I’m using Pro 9.4. I’ve also noticed an error
message in the console when the doc opens, (doc authored and locked down by
another group so I can’t look at code). Could this javascript error be
stopping further vba/acroexch execution?
Note – this error displayed before I try running my VBA code.
Thanks for any additional advice.
Tyler
Tyler Witko
Director Trial Documentation, Clinical Operations
Boehringer Ingelheim Pharmaceuticals Inc.
Office: 203 778-7617 (x 57617)
Cell: 203 417-9173
Hi George,
Thanks for the reply – there is no error message in the vba runtime in
Access. The pdf form I’m trying to write to does display an error when it
initiates and I’m wondering if this is stopping the vba code from working
after the form is open. Here’s the pdf console message generated when the
form opens:
Thanks in advance for any ideas/suggestions.
Tyler
Tyler Witko
Director Trial Documentation, Clinical Operations
Boehringer Ingelheim Pharmaceuticals Inc.
Office: 203 778-7617 (x 57617)
Cell: 203 417-9173
Hi George,
Here’s js console error message the pdf initiation is showing:
Exception in line 45 of function top_level, script XFA:BIForm[0]:initialize
NotAllowedError: Security settings prevent access to this property or method.
SOAP.connect:45:XFA:BIForm[0]:initialize
Would this impact other js calls to document, (i.e. vba/acroexch)? If yes, is
there a way to ‘reset’?
So it looks like you're dealing with an XFA form, which are usually created in LiveCycle Designer. Do you know if it's static or dynamic? You'll likely have problems with dynamic forms, and maybe static forms, as the JavaScript you're using is intended for acroforms create in Acrobat. You can try using the same JavaScript code as you'd using in an XFA form. If you need help with that, it might be best to post in the LiveCycle Designer forum.
North America
Europe, Middle East and Africa
Asia Pacific