Excel First

Excel Solutions

How to Fill PDF Forms in Excel

Site White Background

Fill PDF Forms in Excel

In a previous article: Use Excel to populate PDF Form Fields, I presented a manual method to transport data between Excel and PDF forms, that can be used without a paid version of Adobe Acrobat.

If you have Adobe Acrobat Pro installed OR a trial version (even if it expires and you don’t want to purchase a license), then you can use an Excel App to Fill Out PDF Forms automatically, directly from Excel.

First, download the sample PDF form and the Excel Form Filling Tool from the link below:

Download sample files: Form Filling Tools.zip

How Data is Organized:

First of all, there is a main folder, named Form Filling Tools, that will contain a folder with Templates, all your PDF templates must be stored in the Templates folder.

Inside the Form Filling Tools folder, there is an Excel file named Fill PDF Form.xlsm, this will be our Excel tool that will help us Fill PDF Forms automatically.

When the Excel App will fill a form, it will save it in a folder named Filled Forms, which will be created by code inside the main folder – Form Filling Tools.

The Filled Forms folder is not in the archive you downloaded from the above link, it will be created automatically.

Also, the code will create a sub-folder in Filled Forms for each row of data.

If you have a PDF template to fill for John Doe for example, a sub-folder named John Doe will be created in Filled Forms folder, and that PDF template will go into John Doe folder.

Each PDF created by code will have a time stamp in the file name, to avoid overwriting older forms and to allow you to find the most recent versions.

How to Use the Excel App to Fill Out PDF Forms

I tried to build a flexible structure, to allow users to use this tool with their own PDF Forms. As a result, there are 2 important sheets in the Fill PDF Form.xlsm:

  • Data, which holds a defined table with all your source data, that needs to be sent to PDF forms.
  • Templates List. This sheet will have the details of the selected PDF Template from the Templates folder, the table must be updated using the button named Update Templates List from this sheet. In this version, only 1 PDF Form will be listed.

Important settings you need to make before Starting to Fill Out PDF Forms:

In order to start using the tool, you have to do the following steps:

  1. Press the button named Update Templates List from Templates List sheet, the code will ask you to select a PDF from the templates folder, and for that PDF form will create a new worksheet, with all the form fields listed: PDF field Names, field User Names and field Type.
  2. After the first step, a new sheet will be created for the selected form. The first column in the template sheet has drop-downs, referring to the Data table Headers, you will have to map each field from Data table to the corresponding PDF Field Name from column B: look at column B (PDF field name, and select from column A drop-down the value that should be sent to that field).

Because the PDF Field Names can be different from your Data Table Headers, without this mapping, no data will be sent to PDF form, it’s the only reasonable way to make an association between your Data Headers and the PDF Field Names.

Start Filling the PDF Forms

Finally, we can start filling those Forms! Go to Data sheet and double-click on a name from column A, this is the event that triggers the Form Fill Action.

The code will create a copy of the PDF Form from the Templates folder and it will fill it with data from the selected row from Data sheet.

 

Other things you should know:

In conclusion, I have to emphasize a few issues that might raise errors in this process:

  • This Excel App to Fill Out PDF Forms will work only with AcroForms, you will not be able to fill forms that were created with Live Cycle Designer (those are XFA Forms).
  • If you did not create the PDF Form, or you created the form automatically with Acrobat Tools, most probably you will find a few ambiguous PDF Fields Names, like TextBox1, TextBox2.

It will not help when you do the data mapping. You will have to edit the form to rename those fields, then use the button to Update the Templates List.

There are many improvements that can be made. For example, you may want to:

  • pre-fill the PDF templates from your Templates folder with data, and fill only some fields from Excel.
  • Or, you may want to type default values for some fields, because you don’t have data for those fields in your Data table.
  • Also, a user may want to fill lots of PDF Forms, stored in Templates folder and in subfolders.
  • Another frequent operation some user may need to do is to fill forms for each row in Data sheet, not just one row at a time.

You can do these changes by editing the code, if you have experience with VB programming.

Enjoy!

Catalin Bombea previous

91 Comments to How to Fill PDF Forms in Excel

  1. Sue says:

    I need a personal lesson on this topic! are you available for hire?

  2. Michelle says:

    stumbled across this page, and it worked like a champ on my computer. now I’m needing it to work on a mac for a co-worker and was wondering if you/someone already found the solution.

  3. Andy says:

    Hi There. Great solution! Do you have a solution that would create pages with each row and fill in the row below (similar to a mail merge)?

    • Hi Andy,
      No, but you can do it in a different way: if you have a template PDF with 1 page (or more), you can fill it with data for all your table data rows, when all pdf’s are filled, it’s very easy to merge them into a single PDF.
      Regards,

      • Scott Vang says:

        This product is excellent !!

        Can you provide the instructions on how to print all of the rows in the data tab??

        Thanks πŸ™‚

        • Hi Scott,
          Look after the FillAll code in the comments below.

          Cheers,
          Catalin

          • Scott Vang says:

            Hi Catalin, I have located the code to fill all as you suggested but I am not putting the code in the correct location πŸ™ Can you give me some guiidance??

            Thank you in advance. πŸ™‚

          • Hi Scott,
            You have the instructions here.
            I’ll repeat them for you:
            Press Alt+F11, this will open visual basic Editor.
            On left side, in Project Explorer, you should see a list of Sheet modules and 2 standard modules.
            Double click on FillForms module, on code window (opens on right side) scroll down to the end of codes, paste your codes below.
            Make sure you retype the double quotes, the ones you copy from webpage are not the right ones.

          • Scott Vang says:

            Good afternoon Catalin,

            I have two remaining requests I would like to explore.
            Is there a way to eliminate the confirmation message for each record??
            Also, can the generated pdf files be placed in one folder instead of a folder for each record??

          • Hi Scott,
            You can remove the message, just press Crtl+F to search the code for MsgBox and commnent that line.
            To use a single folder, just comment or delete these 2 lines from WritePDFForms procedure:
            FolderPath = FolderPath & “\” & ValidateName(Wks.Cells(Rw, 1).Value) & “\”
            If FSO.FolderExists(FolderPath) = False Then MkDir FolderPath

  4. Kristine Smith says:

    how do you check checkboxes or radiobutton fields

    • Hi Kristine,
      Depends on the properties of the control.
      For radio buttons, if you have 10 radio buttons and they are grouped with only 1 option possible, you will have to send a value from 1 to 10.
      A checkbox might accept values like: Yes/No, True/False, Yes/Off. The easiest way to see what values that control accepts is to check the checkbox, select a value from radio buttons, and Manage Form Data-Export data – into an xml file. If you open that xml, you will see the control name and the value.
      Cheers,
      Catalin

      • David Robarts says:

        This is almost working for me. When I check the box, the exported data shows a 1 for boxes that are checked and a 0 form boxes that remain unchecked.

        Filling using 1 for the checkbox appears to work (the boxes show as checked when the form is filled), but the checkbox data is not saved. Commenting out the VBA code that closes the filled form, I exported the data from the automatically saved form and all the checkboxes were 0, manually clicking the checkbox in Adobe Acrobat twice (to uncheck then recheck) then exporting the data adds the 1 to the exported data for that checkbox.

        • Hi David,
          You have to go into form editing mode, in Acrobat or whatever app you are using, then go to that checkbox Properties, Options tab, and see what value is in the Export Value field. That Export Value can be anything: 1, True, Yes, David, On, or whatever text you imagine.
          That will be the exact value that you need to send from excel to check that box.

          • David Robarts says:

            I was using the export value, but that didn’t stick – it did show as checked in the form before closing, but did not actually get saved with the form data. I was able to fix it in VBA by using the checkThisBox method of checkbox fields:

            If ColDict.Exists(MapDict(MapKey)) Then
            With objJSO.GetField(MapKey)
            If .Type = “checkbox” Then
            .checkThisBox 0, Wks.Cells(Rw, ColDict(MapDict(MapKey))).Value: Check = True
            Else
            .Value = CStr(Wks.Cells(Rw, ColDict(MapDict(MapKey))).Text): Check = True
            End If
            End With
            End If

          • If it was checked after import and didn’t stick when closing the form, there might be some JavaScript code running and interfering with the values set by code.
            Glad to hear you solved it.
            Cheers,
            Catalin

  5. sjs says:

    how could I modify the VBA script to trigger on a button click instead of double clicking A1?

    • Hi,
      If you want to assign a button to run the code, you need also a new way to indicate what row needs to be transferred to PDF. Using the right click in that row already does that, the code knows what row triggered the code.

      You will have to insert in code an InputBox, where users should select the row that needs to be transferred.

  6. Christopher Bick says:

    Does this really save the time it takes to type the data into the PDF? We file numerous, non-uniform reports, would we need to set this up only once and it would be there for next year to auto fill the new information??

    • Hi Christopher,
      Each PDF file needs to be mapped with excel, the mapping is a one time process, once it’s set you can reuse it (until the PDF form structure is changed, this usually happens when the owner releases a new version). Mapping is easy, you can download the excel file and test it.
      Regards,
      Catalin

  7. Mel Brown says:

    There is no drop down list appearing in the source column. How do select what data should appear in the drop down list. Do I need to modify the code to specify what “sheet” contains the data? Thanks

    • Hi Mel,
      After you set the pdf file path in Templates List sheet, press the button from that page, and a new sheet will be created. That sheet will have dropdowns in Source column (first column), and the dropdown values are coming from the Data sheet table headers, this is your source data. The pdf fields will be listed in column B of the new sheet.

  8. Hi there, first of all thank you so much this help to save a lot of time on my work, I have a question i tested this whit a trial version of adobe acrobat pro? it’s this still going to work after my trial ends?

    • Hi Jonathan,
      That’s related to Acrobat, no idea how they stop the trial, with just warnings or limited functionalities.
      Regards,
      Catalin

      • Hello, I’m back so this happend my license trial of adobe acrobat expired two day’s ago, and I can still use this excel template, no need to buy the membership, just to let all u know. πŸ™‚
        Thanks for this tutorial save a lot of time in my work.
        Have a great day!! πŸ˜€

        • Hi Jonathan,
          Good to know, thanks for sharing.
          For excel, only the acrobat library is needed- Acrobat.tlb, which can be found in C:\Program Files (x86)\Adobe\Acrobat xx.x\Acrobat (depends on acrobat and windows versions).
          Even if the acrobat trial is expired, the library is still there and can be used. Looks like a good clean way to get the library, without hacking the Acrobat files.
          Cheers,

  9. Greg says:

    Hi,

    I had a sudden need of this, found your solution, enjoyed and relaxed πŸ™‚

    Thanks a milion for this brilliant piece of VBA. The only addition would be a button to process all the rows at once. But I can easily add it myself once I stop being lazy πŸ™‚

    Cheers

  10. saul velasquez says:

    Why i can’t add more than one form? i am not getting the option shown in the first picture, “select pdf template”

    • Hi Saul,
      It’s a demo file, built for a single form.
      If you need more forms to be filled in the same time, it needs to be modified to work as you want. The multi-form version is not free unfortunately.
      Regards,
      Catalin

  11. Molly says:

    how can I do it so that the “PDF form file can be in an existing workbook in an existing folder rather than in the “form filing tools” folder?

    • Hi Molly,
      It is possible, but the code gets more complicated, embedded objects are stored in binary format in the excel archive. Code have to read the binary and convert it back to pdf, not sure if it’s a good idea to do it this way.

  12. duhmarus says:

    This is amazing! I wish I could have it merge a bunch of documents at the same time but still, this is a major time saver. I’m teaching myself VBA code now and can’t wait until I learn how to edit this one.

    GIRLS WHO CODE!!

    • It is amazing, congrats πŸ™‚
      Good luck, and have fun!
      Well, it’s not always fun, frustrating sometimes, but when you make it through, beats everything.
      Girls power, even better.

  13. Tobe says:

    Hi,
    I stumbled on your page and this is exactly what I have been looking for. Thanks a lot for sharing the knowledge.

    I downloaded the zip and followed your instruction. I double-clicked on each name and I saw each folder was created for that particular name. What can I do to automate the creating of all PDF’s for all names instead of double-clicking one name at a time? Please advise. Thanks a lot

    • Hi Tobe,
      You can use this code that can send all rows to pdf’s:

      Sub FillAll()
      Dim Sh As Worksheet, tbl As ListObject, Cell As Range
      Set Sh = ThisWorkbook.Worksheets("Data")
      Set tbl = Sh.ListObjects(1)
      For Each Cell In tbl.ListColumns(1).DataBodyRange
      FillSelectedForms Sh, Cell.Row
      Next
      End Sub

      Q: “Also, how do I add more columns and rows on tab Employee Information. Thanks”
      The fields are extracted from the pdf form in the Employee_information sheet, which contains the mapping between the data table and the pdf form. Id does not make sense to add rows and columns in the employee information sheet, these are added automatically from the pdf, when you use the button from “Templates List” sheet to update the pdf template used. If your pdf has more fields, they will show up in the mapping sheet. If you manually add rows in the Employee Information table, this action will NOT add new fields in the PDF form…

      Please read again the article, you might be misunderstanding some things, the application is driven by what is in your pdf form, this is not a pdf form designer.
      If you want to use another pdf, go to templates list, use the button to select another pdf form, change the data table to the data structure needed for the new form, then do the mapping in the new sheet.

  14. Tobe says:

    Hi,
    Thank you very much for your reply. I just want to let you know that I have started enjoying your Excel PDF Mail Merge more and more everyday. So far I have played with different forms and they are all successfully created. As far as the codes, may I ask you to show me where to insert these codes? I really appreciate your sharing of knowledge.

  15. Jonathan says:

    Hi Catalin! Thank you so much for this. I included the code to send all rows to PDF but is there a way to disable the “ok” button confirming the creation of each pdf? Alternatively, is there a code to just click it each time? Thank you again.

    • Hi Jonathan,
      I suggest searching the code for the message you are seeing, for example, using Ctrl+F (same old search shortcut in excel works in visual basic too) to search for “created successfully!” will take you to that line. Put an apostrophe at the beginning of the line will disable it.
      Make sure you set the search to look into entire project.
      I could just indicate the position of the line, but don’t want to spoil your fun πŸ™‚
      Cheers,
      Catalin

  16. Tobe says:

    Hi Catalin,
    I have played with your EXCEL codes and a single click on a row to send to PDF or send all rows to PDF. Recently, I have thought about how to send some selected rows to PDF because let’s say there are 100 rows (records) and after sending all to PDF, we realize that only 10 rows need to be corrected due to typing errors. So, instead of sending single row at a time or sending all rows again, there should be a way to send just selected rows to PDF. If you have any code or suggestion, please share with us. Thanks a lot

    • Hi Tobe,
      There are many ways: you can add a column with values of 1 for the rows you want to send, and check that column value before sending the row to pdf.
      Or, you can filter the table to keep visible only the rows you want to send. In code, simply check the row height: if it’s 0, don’t send it.
      Cheers,
      Catalin

  17. Tobe says:

    Thank you very much for a very quick response. I decided to use a filter and it showed only 10 records and hid the other 90 records. Then I used this codes below and it sent all 100 records to PDF instead of 10 wanted records.

    Sub FillAll()
    Dim Sh As Worksheet, tbl As ListObject, Cell As Range
    Set Sh = ThisWorkbook.Worksheets(“Data”)
    Set tbl = Sh.ListObjects(1)
    For Each Cell In tbl.ListColumns(1).DataBodyRange
    FillSelectedForms Sh, Cell.Row
    Next
    End Sub

    • Hi Tobe,
      As mentioned, you have to adjust the code to check the row height:
      Sub FillAll()
      Dim Sh As Worksheet, tbl As ListObject, Cell As Range
      Set Sh = ThisWorkbook.Worksheets(β€œData”)
      Set tbl = Sh.ListObjects(1)
      For Each Cell In tbl.ListColumns(1).DataBodyRange
      If Cell.RowHeight > 0 Then FillSelectedForms Sh, Cell.Row
      Next
      End Sub

      This will allow you to use filters to send only visible data.
      Cheers,
      Catalin

      • Christopher Pham says:

        Hi Catalin, Thank you so much for sharing your knowledge. I am new to VB so I am learning your code. I successfully generated many PDF files using your code above. However, I tried to find the location in the code to automatically set the OK button value to “clicked” or something like that. If the spreadsheet has 100 rows then the users must click OK 100 times executing the current code. Thank you in advance!

        • Christopher Pham says:

          Actually, I tried the command Application.SendKeys (“{enter}”) and it works.
          I placed it inside the ‘Open the PDF file. like this at the end, but I still have to press OK one time at the beginning:
          End If

          MsgBox ResponseText, vbInformation, “Finished Form Filling”
          End If

          ‘added by Chris Pham
          Application.SendKeys (“{enter}”)

          objAcroAVDoc.Close True

  18. Tobe says:

    I just want to say Thank You Very Much for your help. Your script is very powerful. Thanks a lot.

  19. Tobe says:

    Yes I can do some testing. Thanks

  20. Hi Catalin,

    Great tool, I am just starting to work with it and have 2 questions:

    1. Is there any way to concatenate 2 fields in excel to 1 field in the PDF?

    2. It does not seem to be able to locate the files if stored on Onedrive, I use Office365, is there a workaround or is this an issue with VBA?

    I am not a programmer, but have some knowledge.

    • 1. Yes, best way is to add a new column in your data table, with those 2 columns concatenated, then use this new column for mapping, not the original columns.
      2. On OneDrive, ThisWorkbook.Path might return the “https://d.docs.live.net/” path instead of local path, so you have to replace the http path with the local onedrive path.
      You can find solutions on web. Basically, Environ(“OneDrive”) should provide the onedrive local path, so you can use this to replace the http path.
      Note that for OneDrive business, (office 365), there are more than 1 registry keys:
      Environ(“OneDriveCommercial”)
      For OneDrive Personal, use: Environ(“OneDriveConsumer”) if you have also a OneDrive business account.
      All onedrive keys can be found in registry: Computer\HKEY_CURRENT_USER\Environment

  21. Michael Hopkins says:

    Hi Catalin,

    I wanted to say thank you for making this code freely available to the public. I am playing around with this and have gotten the basic premise. I just have this thorny issue: I have a .xlsx file in a SharePoint library that I linked to the Fill PDF workbook. I now want to take the last line that is created in the linked sheet and update the “data” sheet. Also, I want to have the same attributes from the original three rows (2,3,& 4) for any new row added (as I type this I have a feeling I will have to adjust the code under ‘write fields to table comment to apply the same settings to any new additional row created in the “data” sheet).

    Once again, thank you for all that you have done.

    • It’s not clear what excel version you are using.
      If it’s an excel for windows, newer versions, You should be able to connect to the sharepoint file from the Fill PDF workbook using Power Query. This query should replace the data table, at each query refresh will get all data from that file, no need for additional codes to maintain data sync.

  22. Michael says:

    Hi Catalin,

    I want to first thank you for making this freely available to the public. This has really helped me start on a project for my HR department.

    I just have one issue that I am sure you will solve in a jiffy:

    How/What do I modify in the VB code to treat any new rows that are added in the β€œData” sheet to have the same properties as the sample’s 2nd-3rd rows? Ex. I want to add a new employee β€œJane Doe”, add all of her information in Row 5, double-click on her name and have that applied to the PDF.)

    As of right now, when I add information to a row below Row 4, nothing happens when I double-click the first cell in the row (I just have the normal function of editing the text in the cell when I double-click).

    Once again, thank you for all that you do.

    • Hi Michael,
      Not sure what you mean by “new rows to have the same properties”
      The data is organized into a defined table, whenever you add a new entry under the table, it should automatically autoexpand to include the new row. If it doesn’t, check if the autoexpand functionality is disabled. The setting is not very obvious:
      File->Options->Proofing->Autocorrect Options, make sure that in Autoformat as you Type you have the checkboxes checked.

  23. VC Trout says:

    You are a life saver! I was just given a project to fill in 2 lines on a PDF for 1500 locations and I’m a Volunteer with little admin background. You literally saved me thousands of hours of typing. I couldn’t figure out how to add the script to run them all at once, so I’m doing in batches of 100. Now I just have to figure out how to rename all the pdfs to the format needed.

  24. Evie Totty says:

    Hi Catalin!

    This is awesome, but I am a novice when it comes to coding Excel sheets.

    You indicate using the following to create all the PDFs at once, but where do I put the code? Is there something it should replace? Thanks in advance.

    Sub FillAll()
    Dim Sh As Worksheet, tbl As ListObject, Cell As Range
    Set Sh = ThisWorkbook.Worksheets(“Data”)
    Set tbl = Sh.ListObjects(1)
    For Each Cell In tbl.ListColumns(1).DataBodyRange
    FillSelectedForms Sh, Cell.Row
    Next
    End Sub

    • Hi Evie,
      Press Alt+F11, this will open visual basic Editor.
      On left side, in Project Explorer, you should see a list of Sheet modules and 2 standard modules.
      Double click on FillForms module, on code window (opens on right side) scroll down to the end of codes, paste your codes below.
      Make sure you retype the double quotes, the ones you copy from webpage are not the right ones.

  25. Will says:

    Thank you so much for posting this; this has been a lifesaver.

    I tried figuring this out on my end, but I was hoping you might be able to assist with the file name. I’m a bit new to the coding side of things and couldn’t really make out how it creates the file name.

    Is there a way for me to change the name of the file created? The lines that I use start with dates so all of my files and folders have dates based on the date in the cell. For folders this isn’t a problem, but for the file name, it would be a lot easier if I could pick a different cell, or even make my own name.

    Thanks again!

    • Hi Will,
      This line from FillForms module, WritePDFForms procedure is creating the pdf file name:
      strPDFOutPath = FolderPath & Format(Now(), “yyyy-mm-dd-hh-mm”) & ” ” & ValidateName(Fname & ” ” & .Cells(Rw, 1).Value) & “.pdf”
      This part reads the value from the first column: .Cells(Rw, 1).Value , you can read this way any column to build the name your way, just replace 1 with the column number you want.

  26. Raymond says:

    Thank you very much for this script, very heplful!
    Is it possible to save the pdf files with the form fields flattened, so the pdf’s cannot be modified afterwards?

    • Hi Raymond,
      You have to open the form and run a JavaScript in the PDF:
      Set pdDoc = CreateObject(“AcroExch.PDDoc”)
      Set AForm = CreateObject(“AFormAut.App”)
      pdDoc.Open (Fullpath)
      Set avdoc = pdDoc.OpenAVDoc(Fullpath)
      AForm.Fields.ExecuteThisJavaScript “this.flattenPages();”

      • Raymond says:

        Hi Catalin,

        Thanks for the reply. Yesterday I managed to solve it by adding ‘FlattenForm = objJSO.flattenPages()’ just before the line where the pdf is saved (and of coarse declaring ‘FlattenForm’).

  27. Karl says:

    This is amazing. However, do you know how it can be adjusted to work on SharePoint?

    • Hi Karl,
      The easiest way is to use a cell to store the path to the destination folder and use that instead of the path used in code.
      The hard way: detect the url in registry and get the local path.

  28. David Phillips says:

    Hello! First of all let me say AWESOME! This looks really good and I hope I can use it.

    Unfortunately, I’m getting a general error at the point at which I believe it is trying to save the file. It opens the PDF template and populates it successfully. I don’t really want to have to manually save each form. I do not believe that my form was made with Lifecycle so I don’t know if that’s the issue or not or if it’s something else.

    The Error Number is 424 and the description is Object Required and it occurs in the WritePDFForms routine in this section:
    For Each MapKey In MapDict.Keys
    If ColDict.Exists(MapDict(MapKey)) Then objJSO.GetField(MapKey).Value = CStr(.Cells(Rw, ColDict(MapDict(MapKey))).Text): Check = True
    Next

    Doing some debugging, it seems that the MapDict has one extra key that is empty. I’ve double checked the mapping table to ensure it has the right number of fields. Any suggestions?

    • Hi David,
      It might be a bug in the Acrobat library, if the field name contains a space after the name.
      When the code fails, press debug button, then put your mouse over the MapKey item, this should display the value that failed.
      Or, type ?MapKey in immediate window and press enter.

  29. Niels Cuelenaere says:

    Been hitting a wall with this for a few hours trying to see what’s wrong but:

    “Set formfields = Aformaut.Fields” does not return any formfields for the example PDF and crashes at the next line: “For Each FormField In formfields”

    Not sure why. Debugger shows everything works fine until that line. I’m using adobe pro 64.

    I thought it might be the AFormAut 1.0 Type library reference, but adding that didn’t help either.

    Any clue what might be wrong? I don’t see anyone else reporting issues so I thought I would ask.
    The error I’m getting:

    β€œFieldlist Error β€˜-2147319765’.
    Automation error.
    Cannot find element. VBAProject.”

    • Karl says:

      I am also having a similar issue with this, Niels. This worked for me back in January when I set it up, but now when importing a form to extract field names, the Fieldlist error you posted occurs, and it fails to generate the fields.

      • Can you provide the pdf and the excel file so I can test it?
        Thank you

        • Jerome Colburn says:

          The problem is that the latest versions of Acrobat have eliminated an actually undocumented feature your tool, and another that I have developed independently for a client, have been relying on: the Fields object is no longer a VBA Collection that can be iterated with For Each or accessed with a numeric index as in For intFieldIndex = 1 to Fields.Count. Fields can now be indexed only by the fully qualified field name! To obtain the fully qualified field names from a form, you need to export the fields to an FDF file, then read in and parse that file … which I’ve just developed a module to do.

          • Thanks Jerome for sharing.
            I personally consider Acrobat API not reliable, just too many bugs: a field name that ends with a space throws an error in VB; if there is a value in a PDF form field, that value acts as a formatting restriction (one of the strangest things I’ve seen)
            An external library like Aspose or Syncfusion should work better.
            Cheers,
            Catalin

  30. Charlie says:

    Thanks for this awesome tool! In my template there is an image field, is there a way to add a local image file to a column so it populates the image field in my template?

    thanks in advance πŸ™‚

  31. J. Ski says:

    Hello, Thank you for the awesome Tool. Wanted to see if I can use this to fill a PDF with more than one page. This doesn’t seem to fill in the form fields on anything beyond page 1.

    • Hi,
      The app is not limited to 1 page, it’s limited to 1 PDF, regardless of how many fields there are in that file.
      Make sure the fields are properly mapped to the data table.
      Cheers,
      Catalin

  32. Nathan says:

    Hi Catalin,

    Thankyou very much for this great work, really love it, really helpful for me.
    I did little modification for the pdf name format and also delete the “created successfully” pop up and also turn the pdf to save directly in filled form folder (did not make any additional folder with timestamp)

    i ran this for 1100++ pdf form, i already copy the vba to auto run all the row, but it always stuck on every 276-277 row, It show pop up with :

    Run-time error ‘-2147023170 (800706be)’: Automation error
    the remote procedure call failed.

    if i click debug, it immediately show this highlighted line :

    If objAcroAVDoc.Open(StrPDFPath, “”) = True Then

    do you have solution for this ? Thanks in advance πŸ™‚

    Cheers,
    Nathan

    • Hi Nathan,
      When that line fails, please type in immediate window and press enter:
      ?StrPDFPath

      This will print the path of the file that fails.
      You have to go to that specific file that fails and try to open it manually, see if you get some error messages.
      Make sure also that the length of the StrPDFPath string does not exceed 255 chars, in this case rename the file with a shorter name.

      Cheers,
      Catalin

      • Nathan says:

        Hi Catalin,

        After some few update from adobe, now i used adobe acrobat pro instead of DC, everything was fine except they don’t run automatically. I have to click in every row to pdf every row. Do you have any solution for this ?

  33. Paul says:

    Tried using this and at the Update PDF Templates List button click I’m getting this error –
    FieldList Error: -2146959355 Server execution failed VBAproject. I’m using latest Excel and Acrobat Pro versions. Is there any solution to this error?

  34. Sarah says:

    Hi Catalin,

    Thank you for sharing this for us all to use. I’m running into an issue when I update the PDF templates list using your demo files. The popup error says “No field found, the form might have been created with Live Cycle Designer, this type of form can no be filled with this tool.”

    I am using Adobe Acrobat Pro. Any guidance?

  35. MIKKI says:

    Thanks for sharing this it has made my work life so much easier. I’m running into an issue when I save the file to my network so other coworkers can use it. I get a Run-time error “1001′: NotAllowedError: Security settings prevent access to this property or method. with an option of end, debug, or help button. When I hit the debug it takes me to the line of code: ClearForm = objJSO.ResetForm() ‘clear the form
    Any assistance is greatly appreciated.
    Thanks

    • Hi Mikki,
      In the later versions of Acrobat the security restrictions for this method had changed. It can now only be called from a trusted context, ie a folder-level script or a trusted document.
      Potential Solutions:
      Security Settings in Adobe Acrobat or Reader:

      Some security settings in Adobe Acrobat Reader or Acrobat DC prevent access to certain JavaScript operations.
      You can adjust these settings:
      Go to Edit > Preferences > JavaScript.
      Ensure that Enable Acrobat JavaScript is checked.
      If running on a network drive, check if there are any restrictions on executing JavaScript on external files.
      File Location and Network Policies:

      If the file is located on a network drive, certain group policies might restrict running JavaScript or ActiveX controls from network locations.
      Try copying the file to your local drive to see if the issue persists. If it works locally, there may be network policy restrictions.
      Use Trusted Locations:

      In some cases, adding the network location to Trusted Locations in Adobe Acrobat or your system’s settings may resolve this issue.
      Go to Edit > Preferences > Security (Enhanced).
      Add the network path to Privileged Locations.

      Additionally, verify that the PDF allows for JavaScript execution. Some PDFs have built-in restrictions that prevent certain methods from being called.
      Permissions on the Network:

      Ensure that the network or shared drive where the file is saved has the appropriate read/write permissions for all users, especially when dealing with external objects or libraries like JavaScript or ActiveX.

Leave a Reply

Your email address will not be published. Required fields are marked *

The Excel Learning Journey that I propose for you, is structured in such a way as to offer you the most practical way to learn Excel, free.

Start Your Free Excel Learning Journey!

Enter your email address to subscribe to this blog: