Create text documents from excel file using merge

I am trying to create text documents using the mail merge feature in Microsoft Word. To be as clear as possible, my dream was this:

(1) Put all the values ​​for all documents that will be created in one Excel document (2) Use Word to create the template by selecting the above excel file as a data sheet (3) Run a macro that will use the values ​​from the excel sheet and, perhaps the built-in merge function in Word to create 1 file for each line in an excel sheet using one of the cells as the name of the file to be saved.

The end result will be the ability to create x the number of Word documents using a template that pulls all the values ​​from the excel sheet, including the file name of the generated document.

Please, help.

Thanks in advance.

+4
source share
1 answer

You can do this using Word and Excel Automation , using languages ​​such as Visual Basic 6 (via COM ), VB.Net (via interop ) or C # (via interop ), for example, to retrieve data from a database. In your case, because you just want to create a document based on excel data, the easiest way is to use the MS Word Merge Wizard .

Take a look at: http://office.microsoft.com/en-us/excel-help/print-labels-by-using-excel-data-in-a-word-mail-merge-HP005203760.aspx

+1
source

Source: https://habr.com/ru/post/1314776/


All Articles