Results 1 to 5 of 5
  1. #1
    TerraEarth is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    86

    Automation error with Adobe API?

    I'm having issues with my VBA code, it was working fine on my old laptop but I was recently issued a new one. I reinstalled adobe acrobat pro DC and set up my access database the same as before yet when I tried to run one of my modules I got this error:



    Code:
    Run-time error '-2147319765 (8002802b)':
    Automation error
    Element not found.
    The error occurs on this line: Set Fields = AcroForm.Fields

    Code:
    Sub populate_pdf(doc_num, template_form_directory, output_directory, array_pdf_field, array_pdf_value)    
        Dim AcrobatApplication As Acrobat.CAcroApp
        Dim AVDoc As Acrobat.CAcroAVDoc
        Dim PDDoc As Acrobat.CAcroPDDoc
        Dim counter As Long
    
        Set AcrobatApplication = CreateObject("AcroExch.App")
        Set AVDoc = CreateObject("AcroExch.AVDoc")
        
        pdf_bool = AVDoc.Open(template_form_directory, "")
        If pdf_bool Then
            Debug.Print "Populating: " & doc_num
            Set AcroForm = CreateObject("AFormAut.App")
            Set Fields = AcroForm.Fields 'ERROR TRIGGERS ON THIS LINE!
    Does anyone have any idea how to resolve this issue? I'm pulling my hair out over here.

    P.S.: The program is meant to populate a large amount of pdf forms using a template form and information from the access database tables.

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Are there any missing references to Acrobat Pro?
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    TerraEarth is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    86
    Hey Isla, not that I can tell, let me grab a screenshot real quick for you.

    The one that I used previously was the Adobe Acrobat 10.0 Type Library shown below, note that I was able to create a "AcroExch.App", "AVDoc" and "AFormAut.App" objects just fine, it is only on the "Acroform.Fields" where an issue cropped up.
    Attached Thumbnails Attached Thumbnails references.png  

  4. #4
    TerraEarth is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    86
    Guys, I was able to figure out what the issue was. For some reason Access was throwing a fit over the Acroform and Fields variables not being Dim'd, so I did two things:

    1) Added AFormAut 1.0 to my references (perhaps this was the issue in the first place?)
    2) added the following lines to my list of dim's:

    Code:
        Dim AcrobatApplication As Acrobat.CAcroApp
        Dim AVDoc As Acrobat.CAcroAVDoc
        Dim PDDoc As Acrobat.CAcroPDDoc
        Dim counter As Long
        Dim AcroForm As AFORMAUTLib.AFormApp 'NEW
        Dim Fields As AFORMAUTLib.Fields 'NEW
    And now, my program works like a charm. It's strange because I could have sworn it worked just fine before. If anyone has any insights on this, I'd love to hear it.

  5. #5
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,790
    Added AFormAut 1.0 to my references
    If that is the library that pertains to AcroForm then I'd say that was your issue. Easy to tell - just deselect the reference and try again, but I think you would have to go back to late binding if that's what you meant.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. 440 automation error
    By Homegrownandy in forum Programming
    Replies: 22
    Last Post: 12-17-2018, 05:06 AM
  2. Replies: 2
    Last Post: 04-12-2017, 08:43 AM
  3. IE Automation Error
    By bucko_oz in forum Programming
    Replies: 1
    Last Post: 09-19-2010, 11:28 PM
  4. automation error
    By ashiers in forum Forms
    Replies: 0
    Last Post: 04-16-2009, 11:38 AM
  5. Automation Error
    By aouellette in forum Forms
    Replies: 0
    Last Post: 09-12-2008, 08:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums