#1
|
|||
|
|||
Mail Merge does not split tables if entry has a number in front
i don't really know how to use mail merge my partner set it up and for the most part it works great.
i have an excel macro that opens word and runs a mail merge it grabs data from the excel sheet. places the data in a word document, runs a table joiner macro (as there are space between each heading and name) and everything is how i want.... except my merge field "entry" has two headings that start with some numbers ie. 123 Apple 123 Banana and no matter what i do it combines them under the same group how do i get this to keep them separated like all the other mail merge data mail merge code attached as when i copy and paste it shows the data not the code https://www.dropbox.com/s/085ubqaoyvj4cj9/MailMerge.PNG |
#2
|
||||
|
||||
It seems you want the table to change when the Kart changes. In that case you need to use the Kart field as a key - possible as the second in a pair of keys.
To see how to do so with any mailmerge data source supported by Word, check out my Microsoft Word Catalogue/Directory Mailmerge Tutorial in the 'Sticky' thread at the top of this forum: https://www.msofficeforums.com/mail-...-tutorial.html or: http://www.gmayor.com/Zips/Catalogue%20Mailmerge.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: https://www.msofficeforums.com/mail-...html#post23345 https://www.msofficeforums.com/mail-...html#post30327 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/o...1-1996c14dca5d Conversely, if you're using a relational database or, Excel workbook with a separate table 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/...f-8642e46fa103 For some working examples, see: https://www.msofficeforums.com/mail-...-multiple.html https://www.excelforum.com/excel-gen...ml#post5110813 The DATABASE field can even be used without recourse to a mailmerge. An example of such usage can be found at: https://www.msofficeforums.com/mail-...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 https://onedrive.live.com/?cid=5AEDC...43615E886B!566
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Quote:
Quote:
Quote:
Heres what it does vs what it should https://www.dropbox.com/s/pf71npyosv...erge2.PNG?dl=0 The macro and Mail Merge are fine i think its a bug in the way it handles numbers not letters or im missing something simple. Other classes have duplicate front letters and work fine ie. 'KT Light', 'KT Medium', 'KT Heavy', 'KT Twin'. also other classes with numbers '100' and '200' work fine but '125 Light' and '125 Heavy' seem to merge. If i change it to '125 Light' and '126 Heavy' it works as it should. but alas they are both a '125' class its taking the numbers as the field calling it a duplicate so not separating them and ignoring the letters behind it. So testing any class by putting 125 in front ends up merging them into the 1 table. |
#4
|
||||
|
||||
Presumably, with the ones that do work, the numbers are different, too. Since the 125 class has two groups, you need a merge that accommodates two keys. That is what the tutorial shows how to implement.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
I'm unsure how to implement the two key as '125 Light' and '125 Heavy' are one word / one cell its not two separate cells that i combine.
|
#6
|
|||
|
|||
so it was a simple fix just took some time to get my head around the code and work out what i needed to search for and as soon as i saw a solution i knew it was going to fix it.
i had already tried putting quotation marks in but they were inside the {} not outside. Solution attached https://www.dropbox.com/s/uvphylqtog...lMergeFix.PNG? I had one side effect but that was solved by running my table joiner macro twice. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mail Merge - split merged documents and rename each split document based on text in header | FuriousD | Word VBA | 1 | 05-12-2019 04:06 AM |
Can I split the color of text in front of a shape? | lisach | Publisher | 0 | 12-16-2018 09:08 AM |
Split each page of mail merge into separate pdf | Declan | Mail Merge | 1 | 05-28-2014 02:02 AM |
Mail merge that identifies an autocorrect entry | redzan | Mail Merge | 9 | 05-22-2014 05:23 PM |
Automatically split Mail Merge based on number of pages | SaneMan | Mail Merge | 1 | 12-03-2011 01:11 AM |