View Single Post
  #18   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Word mailmerge how to do multiple If statements


Well, there are two possible problems here.

If you have MERGEFIELD fields /inside/ gen.doc, then you'll need to wrap
them up inside the IF construct I suggested before.

If you want Word to suppress the line

{ IF "{ MERGEFIELD ALERT }"= "GEN" "{INCLUDETEXT"C:\\Mer\\Gen.doc"}"
"{MERGEFIELD ALERT}"}

when Alert is empty, just using the IF is not above, because Word only
suppresses blank lines when they are composed of blank + at least one field
that's blank, and blank fields inserted as a result of an IF don't count. So

{ IF "{ MERGEFIELD ALERT }"= "GEN" "{INCLUDETEXT"C:\\Mer\\Gen.doc"}"
"{MERGEFIELD ALERT}"}{ MERGEFIELD ALERT }

would be suppressed when Alert is blank. But then if Alert is "RED", you
will get

REDRED

rather than just

RED

So again, you would need to do something like

{ IF "{ MERGEFIELD ALERT }"= "" ""
"{ IF "{ MERGEFIELD ALERT }" = "GEN"
"{INCLUDETEXT"C:\\Mer\\Gen.doc"}"
"{MERGEFIELD ALERT}
"}then stuff that should be on the next line

You might need

{ IF "{ MERGEFIELD ALERT }"= "" ""
"{ IF "{ MERGEFIELD ALERT }" = "GEN"
"{INCLUDETEXT"C:\\Mer\\Gen.doc"}
"
"{MERGEFIELD ALERT}
"}then stuff that should be on the next line

depending on what's at the end of gen.doc

Peter Jamieson

"Peter" wrote in message
...
Hi Peter,

Please bear with me on this since I am very green with the "IF"
statements.

I created a new document and put in the following single line:

{ IF "{ MERGEFIELD ALERT }"= "GEN" "{INCLUDETEXT"C:\\Mer\\Gen.doc"}"
"{MERGEFIELD ALERT}"}

I still get the blank field printed. I did check the Gen.doc itself and it
does not print the blank field.

Again, I am green at IF statements and perhaps I'm missing some things in
the document properties as well . . . and your comment: "but you do have
to
get the overall layout right" . . . I agree; perhaps I am overlooking
something.

I have been attempting a SP upgrade from SP1 to SP3. SP1 was a success but
SP3 is giving some difficulty in that it looks for DATA1.MSI for SP1 which
of
course does not exist on my original Office 2000 CD. Anyway, a different
matter altogether and I don't even know if the SP3 will address the "blank
field printing" issue.

Thanks again!

Peter