View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Problems numbering a mailmerge doc with condtional paragraphs

Hi Jollymike,

I see you've posted the same question in multiple forums. Please see: http://www.excelguru.ca/node/7

As for the solution, you could use a series of fields coded along the lines of:
{SET Para 0}¶
{QUOTE "{SET Para {=Para+1}}{=Para}"}¶
and
{IF{MERGEFIELD MyOption1}= "Print" "{SET Para {=Para+1}}{REF Para} Optional Text¶
"}
The first field re-sets a 'Para' numbering bookmark to 0 for each mailmerge record.
The second field updates the 'Para' numbering bookmark and displays the paragraph number for paragraphs of required text. You add
the required text before the paragraph mark.
The third field optionally increments the paragraph count and inserts the optional text, if the relevant mergefield (in this
example, named MyOption1) contains the string 'Print'. Change both the field name and the condition to suit your requirements. Note
that, for the optional text, the final paragraph mark is within the field code. That's because the paragraph mark is suppressed if
there's no text to display. The fields for the optional fields are thus appended to the following paragraph. This means you could
have multiple optional fields all pre-pending a required paragraph. For example:
{QUOTE "{SET Para {=Para+1}}{=Para}"} Required Text¶
{IF{MERGEFIELD MyOption1}= "Print" "{SET Para {=Para+1}}{REF Para} Optional Text¶
"}{IF{MERGEFIELD MyOption2}= "Print" "{SET Para {=Para+1}}{REF Para} Optional Text¶
"}{IF{MERGEFIELD MyOption3}= "Print" "{SET Para {=Para+1}}{REF Para} Optional Text¶
"}{QUOTE "{SET Para {=Para+1}}{=Para}"} Required Text¶

--
Cheers
macropod
[Microsoft MVP - Word]


"JollyMike" wrote in message ...
I am having more than a headache while attempting to autonumber my paragraphs
in a Mergedoc. My document contains conditional paragraphs that are within
IF statements. e.g. 24) blah blah blah {IF {MERGEFIELD asdf} = "True" " 25)
blah blah blah" "" 26) blah blah blah. What I need to do is automatically
renumber paragraphs based on the conditional paragraphs. My document is 26
pages (not including mergecode) and contains 50+ numbered paragraphs
(sections) many of which are conditional. This makes renumbering the entire
document every time I have a conditional paragraph undesirable. I have tried
the {SEQ} method of numbering (which doesn't like IF statements) as well as
normal autonumbering. Nothing has worked for me. Please help, I am running
out of aspirin.

Thx

My Document is laid out as such:

1) unconditional
2) unconditional
3) conditional
4) unconditional
5) conditional
6) conditional
7) unconditional...and so on