Using OLE, I am accessing a given form with the following code:
Function GetTextFieldNames(strFormName As String, strFieldName)
Dim myApp As AcroApp
Dim acForm As Acrobat.AcroPDDoc
Dim jso As Object
Dim strTest As String
Dim Field As Object
'Set the object references
Set myApp = CreateObject("AcroExch.App")
Set acForm = CreateObject("AcroExch.PDDoc")
acForm.Open (strFormName)
Set jso = acForm.GetJSObject
Set Field = jso.getField(strFieldName)
'Clean up
acForm.Close
myApp.Exit
Set myApp = Nothing
Set acForm = Nothing
End Function
The two items that I would like to achieve are:
1. Getting a list of fieldnames on the form referenced
2. Changing the field name (in this case, a textbox or checkbox) programmatically.
However, I have not had any success in retrieving a list of available field names, nor have I been able to modify the name of the field. Any ideas?
i.e. It would be nice one could say
For i = 0 to acForm.[FieldCount]
Set Field = jso.GetField(i)
Print Field.Name
Next i
...and
Field.Name = "NewFieldName"
I hope that helps to explain what I am trying to accomplish. Any ideas are appreciated. Thank you!