Mail merge with a table and have every other row be an alternate color

I have a mail merge document that I create out of Microsoft Access.  I have field code in the merge document to print a contiuous list with group headers.  I have the details for each group in a table and I want the table to print with alternate colors.  I know how to apply the alternate row color to a table in a regular document using the style formatting option.  I believe the problem here is that the field code logic is actually treating every line item as an individual table, thus there are no alternate lines to color.  Is there anyway to present my data in the same layout but get every other detail record to alternate color.  Please see the attached documents.
WordDocExample.jpg
WordDocCode.jpg
arothermelAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GrahamSkanRetiredCommented:
It is possible to apply an alternate-row colouring style to the main table and have the style appear in the (directory-type) result document.

It is not easy to see what is happening from a picture, but you seem to have more than one single-row table in the main document (and in the result document).
0
Joanne M. OrzechManager, Document Services CenterCommented:
I can get a merged file to look like the image below... would that work?
Merged-Table-Color-Rows.jpg
0
arothermelAuthor Commented:
Yes,, as long as the group headers will still work.  That's why the table is in the code twice.  It checks if the record is the first record in a new group and if it is it prints the header and the details, if it is not it prints just the details.  The details are in the table.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Joanne M. OrzechManager, Document Services CenterCommented:
Ok - well, I changed the merge file type to "Directory" and I created a two row table and colored the second row....let me know if that explains it enough....
0
arothermelAuthor Commented:
I think I've figured some more of this out.  The document is being created out of Access using Albert D. Kallal word merge code that is available on the internet.  I believe there is something in his code that no matter what I do to change the document type from a form letter to a directory it always reverts back to a form letter the next time it is opened.  When word is creating the document as a form letter it is placing each table row in a different section so it never alternates the color as there is only one record per table.  I'm going to throw this question over to the access forum and see if anyone there knows how to create a directory document using the mail merge code from Albert Kallal.
0
Joanne M. OrzechManager, Document Services CenterCommented:
Why do you need code to merge?
0
GrahamSkanRetiredCommented:
Can you show us the code or tell us where we can find it?

There is a parameter that determines the output type.

It sounds as if the code is doing
Doc.MailMerge.MainDocumentType =wdFormLetters

You need
Doc.MailMerge.MainDocumentType =wdDirectory 'or wdCatalog (no difference)

0
arothermelAuthor Commented:
0
Joanne M. OrzechManager, Document Services CenterCommented:
I just reviewed the little program.  When your Word document comes up, go to Tools, Letters and Mailings, Mail Merge, and go back to step one where you select the type of document.  At that point, you can make it a directory.

Directory-Mail-Merge.jpg
0
GrahamSkanRetiredCommented:
Thanks.

That Access database contains a VBA-base facility for managing MailMerge. It appears to do the same job as the Mail Merge wizard that comes with Word. It is not clear if it adds any extra value, but in the couple of places that it sets the document type it is hard-coded to Form Letters.

0
Joanne M. OrzechManager, Document Services CenterCommented:
Thanks Graham - After clicking the button to run the merge and it launched Word and opened my file, I just changed it to directory.....and completed the merge manually....

I guess it's a nice program if you're not too familiar with mail merge.

0
arothermelAuthor Commented:
I figured it out.  I had previously changed the main document type in the code to wddirectory but it didn't seem to "stay".  The problem was that in the code where the merged document was being created from the saved template, there was no specification for the main document type.   This made the document open as a form letter, which must be the default even though the template was saved as a directory.  I added the code to specify the document type and it now works.  The bottom line is that Albert's code works beautifully for form letters but if you want to use it to create a directory type document you have to change all references to wdformletters to wddirectory and modify the code sample below to insert a line specifying the document type.

In the function RidesMergeWords add a line specifying the document type:

With WordDoc.MailMerge
      .Destination = 0        ' 0 = new doc
      .MailAsAttachment = False
      .MainDocumentType = wddirectory
      .MailAddressFieldName = ""
      .MailSubject = ""
      .SuppressBlankLines = True
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.