View Single Post
 
Old 06-12-2014, 05:58 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

When you do a mailmerge, all bookmarks in the output document are deleted. Even if that were not the case, you can't have multiple instances of a given bookmark.

And, since the colouring is dependent on the mergefield results, why not use some field coding in the mailmerge main document to apply those colours as the merge occurs? No vba required.

All you should need is a set of fields, one for each condition, in the relevant cell(s), coded as:

{IF{MERGEFIELD MM}= "Category: 1*" "→↵
→" \* Charformat}

{IF{MERGEFIELD MM}= "Category: 2*" "→↵
→" \* Charformat}

{IF{MERGEFIELD MM}= "Category: 3*" "→↵
→" \* Charformat}

{IF{MERGEFIELD MM}= "Category: 4*" "→↵
→" \* Charformat}

{IF{MERGEFIELD MM}= "Category: 5*" "→↵
→" \* Charformat}

where the:
• → is an actual tab character
• ↵ is a manual line break
• each I in IF is highlighted with the relevant highlight colour (the forum software doesn't support highlighting, so I've had to use font colouring instead)
• MM is the data field name
and each cell to be shaded has:
• margins set to 0 all round
• paragraph formatting with a single right-aligned tab-stop set to at least the cell width.
I haven't paid any particular attention to your colour specs, as the above are just to demonstrate the approach. Also, all the fields would be inserted one after the other, without line/paragraph breaks between them - the above separations are just to make the field coding easier to follow.

Note: The field brace pairs (i.e. '{ }') for the above demo field codes are all created in the mailmerge main document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practicable to add them via any of the standard Word dialogues.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote