Copy link to clipboard
Copied
Hi,
I have created in Acrobat Standart DC 2021 (AcroForm) a simple test form with 1 field.
I use the VBA code below to access the field (or any field on the form). References: Adobat Acrobat 10.0 and AFormAut 1.0 are installed.
The code work as expected on Windows 10, Access 2013, Acrobat XI Pro, but fails on Windows 8.1 Pro, Access 2013, Acrobat Standard DC 2021.
On line:
For Each AFormField In AFormFields
I get:
Automation Error
Object Library Invalid or contains references to object definitions that could not be found.
Before the error, the line Debug.Print AFormFields.Count gives me 1 as it should.
What am I missing?
Function testAcroForm()
Dim AcroXApp As Acrobat.AcroApp
Dim AcroXAVDoc As Acrobat.AcroAVDoc
Dim AcroXPDDoc As Acrobat.AcroPDDoc
Dim AFormField As AFORMAUTLib.Field
Dim AFormFields As AFORMAUTLib.Fields
Dim AcroForm As AFORMAUTLib.AFormApp
Set AcroXApp = CreateObject("AcroExch.App")
Set AcroXAVDoc = CreateObject("AcroExch.AVDoc")
If AcroXAVDoc.Open("C:\BD\Testspdf\" & "test.pdf", "") Then
Set AcroXPDDoc = AcroXAVDoc.GetPDDoc
Set AcroForm = CreateObject("AFormAut.App")
Set AFormFields = AcroForm.Fields
Debug.Print AFormFields.Count
For Each AFormField In AFormFields
Debug.Print AFormField.Name, AFormFields.item(AFormField).value
Next AFormField
End If
AcroXPDDoc.Close
AcroXAVDoc.Close False
AcroXApp.Hide
AcroXApp.Exit
End Function
Copy link to clipboard
Copied
I manage to access the field with item:
Set AFormField = AFormFields.item("TextField1")
Debug.Print AFormField.Name
I get the name of the field. No errors.
But I still can't iterate as the SDK says I should: https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/index.html#rhhlterm=aformaut&rhsyn...
Copy link to clipboard
Copied
Nobody can help me?