Mail merge with single first page, and multiple second pages

I'm having a really hard time figuring this one out...

I'm trying to use a mail merge to create a document that has a single first page, and then one or more second pages. 

This is my example (i work for the judiciary)

I have a one-page letter, cover sheet that is generated for each defendant.  It is a letter to a defendant stating that they are scheduled for court.

Then after this first page, there could be one OR more "second" pages.  i.e., there is a one-page court order that is generated for EACH DIFFERENT case that they have in our system.

Merge data spreadsheet (which is probably not set up right) looks something like this...

Name Address Phone Case #
Joe Smith 111 Street Ave 555-555-5555 11111-001
Joe Smith 111 Street Ave 555-555-5555 22222-002
Joe Smith 111 Street Ave 555-555-5555 33333-003
Jane Doe 222 Ave Road 666-666-6666 99999-009
Jane Doe 222 Ave Road 666-666-6666 88888-008
Rick Williams 333 court drive 777-777-7777 00000-000

The Excel sheet (outlined above), is auto-filled with a macro.  So the user isn't populating it manually.  It is grabbed from a different system...but i assume that is irrelevant to the question.

This table is a little bit dumbed down...there are a lot more fields.  But this is the general result that I'm looking for...

(Cover Letter Sheet)

Joe Smith

111 Street Ave

555-555-5555

(new page (first court order))

Case # 11111-001

(new page (court order for next case))

Case # 22222-002

(new page (court order for next case))

Case # 33333-003

(new page (for next def's cover letter))

Jane Doe

222 Ave Road

666-666-6666

(new page(first court order))

Case # 99999-009

(new page (court order for next case))

Case # 88888-008

(new page (for next def's cover letter))

Rick Williams

333 Court Drive

777-777-77777

(new page (for def's court order))

Case #: 00000-00

At first I was running a macro that stored both the cover letter and court order in autotext entries (this is how i've accomplished this type of problem before).  So, the macro inserted the cover letter autoext entry for the first person, fills in the address, etc.  Then loop through each case, inserting an order, filling in the case number, etc., for each case that they have.  Wash, rinse and repeat.  However this is a royal pain as trying to use section breaks, etc. in this situation is a nightmare.  It just never seems to follow the section break rules that i set up for it.  So i thought that a mail merge would be faster and much cleaner.  The second page(s) (court order) is a very complicated table...it has many many rows, columns, and lots of merge fields.  I tried looking into using headers, different first page, etc., doing nested mail merge, but neither seemed to help me solve my problem.

Any advice is greatly appreciated.

Is this something that can be done?  I'm pretty familiar with VBA, so using code to do this wouldn't be a problem..

Word MVP Graham Mayor has created an add-in for this purpose: http://www.gmayor.com/ManyToOne.htm

Please read the page carefully before downloading and using the add-in.

---
Best wishes, HansV
https://www.eileenslounge.com

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I don't think that either Graham's or the Many to One facility on my Merge Tools Add-in will create a separate page for each court order.  As they stand, the details of each court order would be inserted into a separate row of a table in the document. 

It would certainly however be possible to create a customized version where a separate page was used for each court order.

Hope this helps,
Doug Robbins - MVP Office Apps & Services (Word)
dougrobbinsmvp@gmail.com
It's time to replace ‘Diversity, Equity & Inclusion’ with ‘Excellence, Opportunity & Civility’ - V Ramaswamy

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Doug is correct, my Many to One add-in will not do this.

A custom process would be required, and frankly it doesn't matter where you store the fixed texts. They could be building blocks for the fixed texts (as your original premise) or separate documents, or listed in a Word Table or better still an Excel workbook.

Looping through the Worksheet is relatively straightforward, but it would be time consuming to achieve a reliable working version.

What is not so clear from your proposal is whether you want to include all records on the sheet, or just a selection.

If you want to discuss rates, then contact me (or of course Doug) and one of us can take it further. We would however require a sample datasheet (and an example of the finished document). Doug's e-mail address is at the bottom of his message, or you can contact me at supportATgmayor.com (put your forum username in the message subject).

Graham Mayor (Microsoft Word MVP 2002-2019)
For more Word tips and downloads visit my web site
https://www.gmayor.com/Word_pages.htm

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

It would certainly however be possible to create a customized version where a separate page was used for each court order.

When you say "possible to create a customized version", are you talking about working with the add-in...something i could do with it...or doing something without the add-in?

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

What is not so clear from your proposal is whether you want to include all records on the sheet, or just a selection.

To answer your question (i think), I am looping through and including each and every one of the entries on the spreadsheet.  I want to create a cover sheet, and then after that, an order for each separate case # that the defendant has.

Could you offer any advice on doing it one of the other ways you suggested...using separate documents or a Word or Excel table?  I don't know if this is what you're talking about, but the court order is basically one big table...with lots of rows and columns, fields, etc.

When you say separate documents, could you run the merge on each file, and then somehow merge the two documents together?  I guess that would be even more complicated than the autotext method.

When i try to use the autotext, the mess that occurs is with the section/page breaks.  I can insert the additional orders just fine, but often the top part of the second order bumps up to the order on the first page, or it creates a bunch of blank pages at the end of the file as each loop iteration progresses.  I've tried inserting the section breaks via code, as well as on the document itself...coding a delete command after the autotext insert, to get rid of the blank page that inserts itself.  I come so close, but it just never behaves the way i want it to.

What do you think of doing it through Access?  I am very familiar with Access.  Could i set up relationships and do it with some sort of report?  Or is that just going to behave like the add-in (only being able to use a continuous report, nested in the regular report?)

Thanks for all of your quick replies.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Do you need it to be a single document as opposed to separate documents for each defendant (given that presumably these orders are sent to the defendants, so will need to be separated at some point) in order to deliver them?

With separate documents it is a relatively straightforward task to start a new document from a template, which would contain the cover page and a page break before the case data. Then loop through the worksheet to get the defendant's data and insert it sequentially.  There should be no reason to have blank pages, (unless there are extra breaks are in the inserted text) as long as you set a range where the text is to be inserted.

Where you insert the fixed texts from is really immaterial. If it is in the cells of an Excel worksheet then you can read that worksheet into an array using ADODB and process the array to get the data in the document. A Word table you can read from directly, if you open the document, and it works well, but is slower.

Building blocks are already in the template so are inserted quickly, but are more fiddly to set up.

If you want it all in one document then having processed the first defendant, you insert a section break, and start to compile again. Otherwise you save and close then start again,

Graham Mayor (Microsoft Word MVP 2002-2019)
For more Word tips and downloads visit my web site
https://www.gmayor.com/Word_pages.htm

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Thanks for the advice.  I thought about keeping them as separate documents before...the cover sheets and the orders, but i'm not sure if that is acceptable to those who will be using it.  It would certainly be a whole lot easier.

As you mentioned, when you think about it, it would probably be even better that way anyway.  I could even create an envelope on the second page of the cover sheets file.  It would be easy to programmatically open/create the orders using the same merge data after finishing the cover sheets.

I'm going to ask the ones who commissioned me to create this, to see if that is acceptable.  Like i said, now that i think about it, it makes more sense to do it as seperate documents.

Thanks again for your reply and advice.

Regards,

Matt

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

As you say with separate documents, it is a much simpler process. If the users don't want to use separate documents to hold the fixed data then use the building blocks. It is only the setting up of them that is fiddly. Once done they are transparent to the user.
Graham Mayor (Microsoft Word MVP 2002-2019)
For more Word tips and downloads visit my web site
https://www.gmayor.com/Word_pages.htm

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

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/showthread.php/154370-Microsoft-Word-Catalogue-Directory-Mailmerge-Tutorial
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.

Although the tutorial envisages the repeated data all occurring on the same page, there's no in-principal reason you can't have each element for a given group span its own page. For your requirements, it appears you could use the tutorial's 'Inserting Content Before the Repeated Data' example, re-coded slightly, along the lines of:

{QUOTE{IF{MERGESEQ}= 1 {SET Key ""}}"{IF{MERGEFIELD Name}<> {REF Key} "{IF{MERGESEQ}> 1 "

"}To: {MERGEFIELD Name}

{MERGEFIELD Address}{SET Key {MERGEFIELD State}}
You have been summoned to appear in the cases listed in the attachment to this writ.

Clerk of Courts {DATE \@ "MMMM D, YYYY"}{QUOTE 12}"}

Fusce aliquet pede non pede. Suspendisse dapibus lorem pellentesque magna. Integer nulla. Donec blandit feugiat ligula. Donec hendrerit, felis et imperdiet euismod, purus ipsum pretium metus, in lacinia nulla nisl eget sapien.

{MERGEFIELD Name}

{MERGEFIELD Address}

You are required to appear in the case {MERGEFIELD Case}

Donec ut est in lectus consequat consequat. Etiam eget dui. Aliquam erat volutpat. Sed at lorem in nunc porta tristique. Proin nec augue.
{QUOTE 12}"}

 
Cheers
Paul Edstein
(Fmr MS MVP - Word)

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated June 15, 2023 Views 4,695 Applies to: