Access AcroForm with VBA fails on Acrobat Standard DC 2021

New Here ,
Apr 04, 2021 Apr 04, 2021

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

 

TOPICS
Bug

Views

121

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 07, 2021 Apr 07, 2021

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...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 12, 2021 Apr 12, 2021

Copy link to clipboard

Copied

LATEST

Nobody can help me?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines