We help IT Professionals succeed at work.

How to use mail merge to create a list sorted by category in Word

Daniel80202
Daniel80202 asked
on
I've tried to search for this on the site, but Im not quire sure how to search it out.

I am doing a MS Word Mail Merge.  Each mail merged letter will be for a person with multiple lines in the Excel Spreadsheet.  I only want to generate one letter per person, but include a "Location" field from each row.  

Example Data:
Permit No | Name             |Location
1               |John Doe        |Section 22
1               |John Doe        |Section 23
1               |John Doe        |Section 24
2               |Bill Smith         |Section 12
2               |Bill Smith         |Section 18

I would like the letter to read as follows:

John Doe,
You own multiple tracts as follows:
Section 22
Section 23
Section 24

Bill Smith,
You own multiple tracts as follows:
Section 12
Section 18

I found an article at: http://support.microsoft.com/kb/294686/#2 which seems to be what I am looking for, but I can't get it to work.  I am most likely the issue with this one, as I have never worked with the SET or MERGESEQ functions.  I also don't know if there is a way that I can manually enter the field braces and merge fields or if I need to enter it from the tool bar.

Here is the example they use:

{ If { MERGESEQ } = "1" "{ MERGEFIELD CITY \* Upper }¶
" "" }{ SET Place1 { MERGEFIELD CITY }}¶
{ IF { Place2 } <> { Place1 }"¶
{ MERGEFIELD CITY \* Upper }¶

{ MERGEFIELD EMPLOYEE }{ MERGEFIELD SALES }" "{ MERGEFIELD EMPLOYEE }{ MERGEFIELD SALES }" }{ SET Place2 { MERGEFIELD CITY }}¶
Comment
Watch Question

GrahamSkanRetired
Top Expert 2012
Commented:
You can enter the field code brackets with Ctrl+F9. The will enclose the selection.

You might find this article useful:

http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Word/A_7236-Macro-code-to-convert-text-to-fields-in-Microsoft-Word.html

Author

Commented:
Unfortunately, I am not well versed with VBA, so I don't know how to convert the above to VBA.  I used CTRL+F9 to enter the example that Microsoft used, but it didn't work.
I liked this KB article better. I think they do a better job of explaining how to do the merge. Spacing is EXTREMELY important. Even though the article is written for 2000, it is still relevant for 2010.

I've attached example documents for you to mess with.

Dawn Bleuel
Word MVP
Data.xlsx
Main-Document.docx
Oops - here is the KB link...

http://support.microsoft.com/?kbid=211303

Dawn Bleuel
Word MVP