Opening and populating a PDF form with VBA code in Access 2007

I had posted this in Acrobat Windows.  It was suggested this (and the SDK forum) may be a better forum ...
I'm trying to load and then populate a PDF form programmatically using Access/VBA.  I'm patterning this after code that worked fine in Acrobat 5.0 but is throwing errors in Acrobat 9.  We're using Access 2007 on Windows XP and Vista computers.
The Access project has a reference to Adobe Acrobat 9.0 Type Library.  Attached is a jpg showing all the references in the Access project.
The error "Object variable not set (Error 91)" is happening with this statement:
Set PDDoc = AVDoc.GetPDDoc
Here is the code I'm trying to use.  I've always been a little fuzzy exactly which objects need to be created and the sequence they need to be created in.  Once I got it working in Acrobat 5 I left it alone.
    Dim WshShell As Object
    Dim myApp As Acrobat.AcroApp
    Dim AVDoc As Acrobat.AcroAVDoc
    Dim PDDoc As Acrobat.AcroPDDoc
    Dim PauseTime, Start
    Set WshShell = CreateObject("Wscript.Shell")
    ' run the Acrobat application within that shell and pass it a document name
    WshShell.Run "Acrobat.exe C:\Users\Christian\Documents\data\dist5\dist05_face_only_nh.pdf"
    '// Set/Get Acrobat Objects
    ' create an automation object that references the active copy of Acrobat
    Set myApp = CreateObject("AcroExch.App")
    ' reference the acrobat document we loaded above
    'Set AVDoc = CreateObject("AcroExch.AVDoc")
    Set AVDoc = myApp.GetActiveDoc()
    ' this apparently runs some method available to AVDOC
    Set PDDoc = AVDoc.GetPDDoc      '<------------------ THIS IS THE LINE THROWING THE ERROR
    ' this is how you reference the JSObject
    Set jso = PDDoc.GetJSObject
    ' let's clear the form
    temp = jso.resetForm()
    Set x = jso.getField("txt1_name")
    x.Value = "Bing Crosby"
    Set x = jso.getField("txt2_sex")
    x.Value = "Male"
    Set WshShell = Nothing
    Set myApp = Nothing
    Set AVDoc = Nothing
    Set PDDoc = Nothing
Thanks in advance for any help.
Christian Bahnsen

Using the "Developing Applications Using Interapplication Communication" reference, I've been filling in knowledge gaps and baby-stepping until I hit this major wall.  FYI:  from page 22 in the reference
Example 2.6 Displaying “Hello, Acrobat!” in the JavaScript console will not work as shown in Access VBA.  I've tried the example in both Access 2003 and 2007.  The sample code as is throws error 91 (see attachment error91.jpg), "Object variable ... not set".
I add Set to the following 3 lines:
    Set gApp = CreateObject("AcroExch.App")
    Set gPDDoc = CreateObject("AcroExch.PDDoc")
    Set jso = gPDDoc.GetJSObject
Running the code after adding "Set" doesn't throw an error but it does crash Access every time.  (see attachment error_reporting.jpg)
Any suggestions?
Here's the entire code snippet:
Private Sub cmdHelloAcrobat_Click()
    Dim gApp As Acrobat.CAcroApp
    Dim gPDDoc As Acrobat.CAcroPDDoc
    Dim jso As Object
    Set gApp = CreateObject("AcroExch.App")
    Set gPDDoc = CreateObject("AcroExch.PDDoc")
    If gPDDoc.Open("C:\chris\acrobat_test.pdf") Then
        Set jso = gPDDoc.GetJSObject
        jso.console.Show
        jso.console.Clear
        jso.console.println ("Hello, Acrobat!")
        gApp.Show
    End If
End Sub

Similar Messages

  • Populating a PDF form with database data

    I would love to know how (if possible) to populate an Adobe PDF form with data pulled from an Access database.
    Background
    I have a registration form already created using Adobe LiveCycle which is used by people to fill in their details.  With a built-in xml schema, the user saves the form and sends them to me.  I extract the data into an xml document which I can then import in an Access database using VBA code.
    The Need
    When it comes time to re-register, much of the original data provided by the user has not changed.  Rather than ask them to fill out the form all over again, I would like to send them their original data and they can update whichever fields they need to.  With the xml schema built into the form, I would love to turn this form into a two-way avenue for both importing and exporting data.  Is this possible?
    Any assistance in this matter would be greatly appreciated.  Please let me know if I have not provided enough information.
    Brett

    You can connect the form to the DB using anODBC connection. This functionality comes as part of Acrobat but the form must be Reader Extended by the full LiveCycle Server version of Reader Extension to allow this in Reader. In your case, if your system is the only on ethat will interact with the DB then this might be a viable solution (but you woudl have to use Acrobat). This solution woudl involve create an ODBC connection in your system then configuring the form to make use of that connection.
    Does that make sense?
    Paul

  • Is it too much to ask that a Mac user can just OPEN and USE a PDF form created by LiveCycle Designer PC software?!?

    My problem is just that- I have created all my forms using LiveCycle Designer because it is easier to make the forms accessible to individuals with disabilities.  Apparently it doesn't make Mac users have access to the forms.  I've received complaints from Mac users that cannot complete or submit the forms that I created.  I'm not asking how to recreate using another software, I know how to do that.  I'm asking is there a work around to allow a Mac user to open a PDF form or even XML (bedded within an HTML page) on a Mac computer WITHOUT having to use bootcamp, parallels, etc. and be able to complete the form and submit, print or email it?????  I've exhausted all my knowledge on this thus far and I'm hoping to find something that will help.  So far all forums talk about how Mac users need to have a PC side to their computer.  Isn't there another way?
    I've attached an example form that we are no longer using (though still created exactly the same as the others)
    Thanks!

    Hi, as far as I can infer, that term means it's not loading any resources until needed, opposite of this...
    -bind_at_load
                     Sets a bit in the mach header of the resulting binary which tells dyld to bind all symbols                when the binary is loaded, rather than lazily.
    https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/ man1/ld.1.html
    Load resources lazily.
    You should never load a resource file until it is actually needed. Prefetching resource files may seem like a way to save time, but this practice actually slows down your app right away. In addition, if you end up not using the resource, loading it wastes memory for no good purpose.
    http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneos programmingguide/PerformanceTuning/PerformanceTuning.html
    And, higher OS versionsare even worse with Bonjour/mDNSResponder, but might see this...
    http://support.apple.com/kb/ht3789

  • Populating a PDF form with XML data

    Hi folks,
    I would like to create some pdf form template, populate it with xml data and output from it a pdf file.
    Can I do such thing using LiveCycle?
    Yair

    With the recent release Adobe changed the name to Adobe Digitial Enterprise Platform (ADEP)..
    http://www.adobe.com/solutions/customer-experience/enterprise-platform.html
    ADEP server software comes with lot of services to help with many solutions for the enterprises, so it would be better to call the Adobe Sales team and discuss your needs and they will be best people to suggest what suits your company requirements.
    Thanks
    Srini

  • How to open a pdf form with fdf data

    Hi all,
          I am working on a new project. In that, I have to load a PDF contract form with FDF data on Internet Explorer Window.
    I don't know how to do it. Actually I tried using this format on the URL (while loading the respective page)
    http://www.example.org/pdf_file_name.pdf#FDF=http://www.example.org/fdf_file_name.fdf
    But it opened as an empty pdf document. . Actually I need it with the fdf data.
    Can anyone know any other way to do this?
    Or is this not possible to open a pdf form with fdf data in a browser?
    Thanks in advance
    Annamalai

    @ Bernd. It still opens a text file
    Here's my FDF file sample
    %FDF-1.2
    %âãÏÓ
    1 0 obj
    <<
    /FDF << /Fields
    <</V (07/22/2009)/T (Loan_Note_Date)>><</V (22.29)/T (Loan_AnnualPercentage_Rate)>></V ()/T (Seller_ESignatureArea1_Date)>><</V (GA Dealer)/T (Seller_Signer_FullNameTitle)>><</V ()/T (ThirdParty_ESignatureArea1_Date)>>
    /F (MARSMFLZ.pdf)/ID [ <1f0b6b55f345db39e8246247138fe562><e960588530b0d06d35cd618b34d4c314>
    ]>>
    >> endobj
    trailer
    <<
    /Root 1 0 R
    >>
    %%EOF
    (I have uploaded the related pdf file before.)
    Just now I got an idea to use WScript (the code is written in javascript)
    ws = new ActiveXObject("WScript.shell");
    ws.Run('"AcroRd32.exe" "C:\\annukar\\Refi\\Refinance_Module\\Forms\\Contract.fdf"', 1, true);
    this opens my fdf document in Acrobat reader using command prompt.
    I have a doubt now, can i use some string in place of "C:\\annukar\\Refi\\Refinance_Module\\Forms\\Contract.fdf" in the above command?
    I mean something like fdf_file = "C:\\annukar\\Refi\\Refinance_Module\\Forms\\Contract.fdf"
    and replace ws.Run('"AcroRd32.exe" fdf_file,1,true). I tried it but it doesn't work Any idea's? Since the path will not remain the same always. So i need to change it

  • PDF form with buttons opens up URL with security warning window

    I have a short-lived process that renders PDF form with data merged. The data is in XML format. 
    The form buttons are assigned URL values when the form is opened. When I click on them,I get a Security warning prompting me to allow/block that site. When I click on 'Allow', I get a window of download statistics of the website that in the URL.
    This would be annoying to the end user. How I do I suppress the Security warning window as well as the download statistics window before the PDF is opened ? Can this be done either at the process design, form design stage or using Java APIs ?
    Thanks,
    Jyothi

    I have a short-lived process that renders PDF form with data merged. The data is in XML format. 
    The form buttons are assigned URL values when the form is opened. When I click on them,I get a Security warning prompting me to allow/block that site. When I click on 'Allow', I get a window of download statistics of the website that in the URL.
    This would be annoying to the end user. How I do I suppress the Security warning window as well as the download statistics window before the PDF is opened ? Can this be done either at the process design, form design stage or using Java APIs ?
    Thanks,
    Jyothi

  • Looking to create editable PDF forms with drop downs and text boxes for use on a Mac computer and iPad. Which product do I need to purchase? Do not need anything fancy

    Looking to create editable PDF forms with drop downs and text boxes for use on a Mac computer and iPad. Which product do I need to purchase? Do not need anything fancy

    Basically you would need Acrobat. However, it is now also possible to create basic form fields using just the free Reader. In fact, I've been working on a tool that allows you to do it, so if you're interested in it please contact me privately.

  • I am trying to open a file in pdf form and I keep getting "there was

    I am trying to open a file in pdf form and I keep getting ...there was a problem reading this document....any suggestions???

    Hi,
    Thanks for reporting the issue; we would like to reproduce it at our end. Please give in the below information to investigate on this,
    1. The Linux distribution (Version of Linux) you are using.
    2. Are you opening the pdf from shared location? If yes, then how is the shared location mounted.
    It would help if you can send in the pdf you are trying to open. Please email the same to vaibhavp at adobe dot com or attach it on the forum.
    Thanks,
    Vaibhav

  • Dynamically populating a PDF form?

    I've created a form in InDesign that I use in my daily work -- it has several fields that hold information about issues I'm currently working on.  This information comes from a proprietary in-house system that I have access to via JDBC, SQL, language bindings, etc.  I would like to take my InDesign document, create a PDF form with it, and then have new PDFs automatically generated with the data provided by our own database.  I can handle 90% of this, but the Adobe end of it is confusing and (frankly) a bit frustrating.
    I can make a static PDF from InDesign just fine, but how can I create a PDF that is meant to be populated at a later time using external data?  I can put it any format - XML, CSV, whatever you want.  I just don't want to have to launch InDesign every time I want to print a new form.  Launching Acrobat would be fine, if not optimal -- at least in Acrobat I don't have to be careful not to mess up the source document.
    I would love it if Adobe provided a way (outside of LifeCycle - I don't have the money for that) to automate this entirely within CreativeCloud, but I am more than competent with outside programming environments if that's going to be required.
    Can anyone give me some direction with this?

    Irosenth,
    Thanks for the response.  I'm going with option 2.  For anyone finding this question in the future, here's the tutorial video to create an interactive PDF from InDesign:
    Create an interactive PDF | Adobe Creative Cloud tutorials

  • Using iPad2 to fill PDF forms with calculating cells

    I currently have the PDF Expert app. installed.  I have created a PDF form with calculating cells and cells with multiple selections using Adobe Acrobat X Pro.  It works on my PC on 2 different PDF reader apps, however when I load it in PDF Expert on the iPad it does not calculate and the multiple selections aren't there.  It also does not keep the formatting of the cell.  I set the cells up as currency, however it does not show as currency once loaded in the PDF Expert app on the iPad.  Is there an app out there for the iPad that will allow PDF form fill in and will also show the cell formatting and calculations? Or is this a limitation caused by iOS? I have also tried Adobe's reader app for the iPad and it doesn't show it on there as well.  Any help would be greatly appreciated! Thanks!

    I'd be amazed if you could. I wouldn't think it possible to even open a PDF, much less edit one.

  • Hi... I would like to purchase a Tablet Sony Xperia Z 2 10.1 (the last one of the Z series) and I was told that Adobe does not support Sony anymore.... I need to be able to open and read Adobe PDF files and I would like to know if this tablet can still us

    Hi... I would like to purchase a Tablet Sony Xperia Z 2 10.1 (the last one of the Z series) and I was told that Adobe does not support Sony anymore.... I need to be able to open and read Adobe PDF files and I would like to know if this tablet can still use Flash Player...
    Is there anyo who can help me with this? I asked in the shop and I was told "yes of course" , but when I contacted Sony directly I was advised to check with Adobe as apparently in the recent months Adobe and Sony haven't been getting along anymore...

    You may be mixing up two entirely different Adobe products.
    1. Adobe Flash Player. Needed to view web pages designed with Flash. Not needed to view PDF files. Not available for Android (not just Sony).
    2. Adobe Reader. Reads PDF files. However, the Android can also read most PDF files without needing Adobe Reader.

  • Is possible in acrobat reader fill in and save interactive PDF created with LiveCycle Designer?

    is possible in acrobat reader fill in and save interactive PDF created with LiveCycle Designer?

    Hi,
    Only if the form has been Reader Enabled before it is sent out to the user with Reader.
    There are two ways of Reader Enabling the form. One using Acrobat Standard v9 or Acrobat Professional v8 (both have license restrictions). The other is to use LC Reader Extensions ES2, which is a server product (additional costs).
    Some info here:
    http://www.assuredynamics.com/index.php/2010/11/using-livecycle-forms-in-acrobat-and-reade r/
    A search of the forums for "Reader Extensions" or "Reader Enable" will give more information.
    Hope that helps,
    Niall
    Assure Dynamics

  • How can I open McAfee encrypted (EEFF) PDF files with Adobe Reader?

    How can I open McAfee encrypted (EEFF) PDF files with Adobe Reader?  Get error "There was an error opening this document. Access denied".  Disabling Protected Mode in Reader doesn’t always work.
    McAfee: https://kc.mcafee.com/corporate/index?page=content&id=KB74299&actp=search&viewlocale=en_US &searchid=1240943327683

    If Reader ISN'T in the list of prpgrams to open with, click "Browse"
    In the "Browse window" go to C/Program files [or Program Files (x86)]/Adobe/Reader 11/Reader
    Select "AcroRd32.exe" and click "Open"
    Make sure "Always use the selected program to open this kind of file" is checked and click "OK".

  • Saving and sending a pdf form in a non-editable format (i.e. as an image)

    I have created a pdf form with editable fields (text fields, drop-down menus etc). After the form has been filled and graphically signed, I would like create a button to the form, which would save the form in a format that can not anymore be edited and then send this "image" form  via e-mail. How could I do this ??

    You can flatten the form to make form fields un-editable.
    Go to Tools pane > Print Production > Preflight > PDF Fixups > Flatten Annotations and Form Fields
    You can also create a custom Action to achieve this at a click of a button.

  • Filling out a pdf form with C#

    We have some pdf forms that I have put textboxes, checkboxes, etc on with LiveCycle. I want to write a C# program that will ask the user some questions and send the pdf form the data to fill it out. On my development machine I have VS 2005, .Net platform 2.0, and Adobe Professional 8. The program runs fine on that machine. I downloaded the SDK and modified the FillFormCS code to build the test project.
    Is it possible to do the same kind of thing with just having Adobe Reader 8 installed? Is there an SDK example that shows how?
    Thanks,
    Khari

    > Is it possible to do the same kind of thing with just having Adobe Reader 8 installed?
    No.

Maybe you are looking for