# Mail Merge- Dynamic Tables



## Skywalker786 (Jan 29, 2018)

I am creating one word report (Office 2013) using mail merge wherein data will be fed into excel sheet and it will be used as a data source for mail merge. I am able to achieve all this, but now I have a requirement of Tables in the same word report . The table is dynamic in nature, I want to get the no. of rows entered by user in the excel and that many rows of table to be created in the word.
Pls. suggest me how to achieve this by Mail Merge or by VBA .
Also, if this type of functionality is not possible in mail merge please suggest alternative software which can be used.


----------



## Macropod (Jan 30, 2018)

You can use Word's Catalogue/Directory Mailmerge facility for this (the terminology depends on the Word version). To see how to do so with any mailmerge data source supported by Word, check out my *Microsoft Word Catalogue/Directory Mailmerge Tutorial* at:
http://windowssecrets.com/forums/sh...t-Word-Catalogue-Directory-Mailmerge-Tutorial
or:
http://www.gmayor.com/Zips/Catalogue Mailmerge.zip
The tutorial covers everything from list creation to the insertion & calculation of values in multi-record tables in letters. Do read the tutorial before trying to use the mailmerge document included with it.

Depending on what you're trying to achieve, the field coding for this can be complex. However, since the tutorial document includes working field codes for all of its examples, most of the hard work has already been done for you - you should be able to do little more than copy/paste the relevant field codes into your own mailmerge main document, substitute/insert  your own field names and adjust the formatting to get the results you desire. For some worked examples, see the attachments to the posts at:
http://www.msofficeforums.com/mail-...ate-names-but-different-dollar.html#post23345
http://www.msofficeforums.com/mail-...creating-list-multiple-records.html#post30327
http://windowssecrets.com/forums/sh...able-Directory?p=928391&viewfull=1#post928391

Another option would be to use a DATABASE field in a normal ‘letter’ mailmerge main document and a macro to drive the process. An outline of this approach can be found at: http://answers.microsoft.com/en-us/...g-tables/8bce1798-fbe8-41f9-a121-1996c14dca5d
Conversely, if your workbook has a separate sheet with just a single instance of each of the grouping criteria, a DATABASE field in a normal ‘letter’ mailmerge main document could be used without the need for a macro. An outline of this approach can be found at:
https://answers.microsoft.com/en-us...gle-page/4edb4654-27e0-47d2-bd5f-8642e46fa103 
For a working example, see:
http://www.msofficeforums.com/mail-merge/37844-mail-merge-using-one-excel-file-multiple.html

The DATABASE field can even be used without recourse to a mailmerge. An example of such usage can be found at: http://www.msofficeforums.com/mail-merge/21847-mail-merge-into-different-coloumns.html#post67097

Alternatively, you may want to try one of the Many-to-One Mail Merge add-ins, from:
Graham Mayor at http://www.gmayor.com/ManyToOne.htm; or
Doug Robbins at http://bit.ly/1hduSCB


----------



## Macropod (Jan 30, 2018)

Cross-posted at: https://www.excelforum.com/excel-general/1217557-mail-merge-dynamic-tables.html
Please read Mr Excel's policy on Cross-Posting in rule 13: http://www.mrexcel.com/forum/board-announcements/99490-forum-rules.html


----------



## Skywalker786 (Jan 30, 2018)

Thanks Paul for replying to my query. I apologize for cross-posting as I was not completely aware of the policy.


----------



## Skywalker786 (Feb 5, 2018)

Dear Sir,

I read the tutorial provided by you. I looked into directory mail merge and I think it is the way to solve by problem. But I am unable to move ahead. I am uplaoding a test/sample of the documents explaining what I want to achieve. I would really appreciate if you could look into it and guide me in the right direction into how to achieve my objective.
The files are uploaded on dropbox.
https://www.dropbox.com/sh/elacdp33jh290qe/AAAOd3U3UCN4uDKO5mvhImGSa?dl=0

Many Thanks


----------



## Macropod (Feb 5, 2018)

Nothing in your link indicates that a mailmerge is required; at most it appears you might need two DATABASE fields, per the final link I gave on that method.


----------



## Skywalker786 (Feb 15, 2018)

Macropod said:


> Nothing in your link indicates that a mailmerge is required; at most it appears you might need two DATABASE fields, per the final link I gave on that method.




Thanks a lot sir. This is what I needed. DATABASE fields solved my problem and I am able to achieve what I wanted. Your help is highly appreciated.


----------

