Link to home
Start Free TrialLog in
Avatar of arothermel
arothermel

asked on

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
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

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).
I can get a merged file to look like the image below... would that work?
Merged-Table-Color-Rows.jpg
Avatar of arothermel
arothermel

ASKER

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.
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....
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.
Why do you need code to merge?
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)

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
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.

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.

ASKER CERTIFIED SOLUTION
Avatar of arothermel
arothermel

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial