# VBA Import data from Excel to PDF text boxes



## TBRoberts (Dec 14, 2017)

Hey guys/gals, I'm trying to use VBA to populate an interactive PDF with data used from excel. 

Please refer to the following link, which describes what I am trying to accomplish:

http://forums.adobe.com/thread/2069492


Excel data will consist of accounting values, such as various line items consisting of credits, debits, amounts, dates etc..

There will be a text box at the bottom of this PDF, which will consist of a narrative, incorporating total number of credits, total number of debits, date range of activity ("from xx/xx/xx to xx/xx/xx, there were xx credits and xx debits totaling $xx.xx"). I would like to populate the referenced "xx" with data from the excel spreadsheet.

I was wondering if it is possible to automate this process with VBA. I have tried searching the web to no avail, so if there are any good resources on this topic that you may know of, please share! 

- TBR


----------



## TBRoberts (Dec 14, 2017)

Just to clarify - I would like the macro to populate the text boxes in the PDF as shown in the link provided *AND* populate the referenced narrative portion.


----------



## Macropod (Dec 14, 2017)

See https://www.mrexcel.com/forum/excel-questions/924748-exporting-pdf-excel.html. The code there could easily-enough be adapted to populate pdf textboxes instead of retrieving their contents. Do note that this requires you to have Adobe Acrobat Pro installed, not just the free Reader.


----------



## Beyond_avarice (Dec 14, 2017)

The link you provided shows Form fields and not "Text Boxes".

If you have Acrobat Standard or Pro; you can import a Tab Delimited file of your data. I have created Excel workbooks that have utilized Excels "Defined Names" as means of mimicking the Form Field names and then Scripted the workbook to create a Tab delimited file with the first line equal to the Acrobat Form Field Names and then the second line equal to the value that is within those cells. Similar to the link you presented.

If you have the Standard or Pro software; you can then import the Tab Delimited file. PDF's are incremental forms, so you should occasionally save as an earlier version of Adobe. Otherwise your form will continue to grow in size with every import. 

Additionally you can set up forms that Adobe Reader users can select a button that will import the tab delimited file. This functionality, however, is extremely limited due to security issues and you would have to set up a folder permission to allow this.


----------



## TBRoberts (Dec 15, 2017)

Thanks for the input guys I will start to develop and circle back


----------

