Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Peter is offline
external usenet poster
 
Posts: 111
Default Word mailmerge how to do multiple If statements

Hi Doug, Peter and Ed,

Really appreciate all your advice and tips. I have being trying all the
various tests as suggested. The end result is that I am still getting the
blank line on merge outputs other than new document. When I get back to my
office tomorrow I will apply the SP3 pack to my MS Word. Not sure if that
alone will make the difference in all of this.

Depending on the project deadline I may just apply the merge to a new
document and then print pdf files from there. Creating new documents for me
creates a real slow down in my project. I have over 14,000 letters to merge
from 5 different letter formats. Even though I merge in blocks of 500, the
merge to "new document" is very slow (even with the spell check off).

Anyway, thanks again. Frankly, I'm blown away by your efforts and advice .
.. . much appreciate it!

Peter
ps - I will let you know if I resolve the problem . . .


  #2   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

It would surprise me if the

{ IF "{ MERGEFIELD x }" = "" ""
"{ MERGEFIELD x }
" }

approach did not work, but you do have to get the overall layout right.

If you have

before
{ MERGEFIELD x }
after

and you want a blank { MERGEFIELD x } to result in

before
after

then you have to use something like

before
{ IF "{ MERGEFIELD x }" = "" ""
"{ MERGEFIELD x }
" }after

or if you prefer fewer lines

before
{ IF "{ MERGEFIELD x }" = "" "" "{ MERGEFIELD x }
" }after

not

before
{ IF "{ MERGEFIELD x }" = "" "" "{ MERGEFIELD x }
" }
after

but perhaps that doesn't work on your setup either...

Peter Jamieson

"Peter" wrote in message
...
Hi Doug, Peter and Ed,

Really appreciate all your advice and tips. I have being trying all the
various tests as suggested. The end result is that I am still getting the
blank line on merge outputs other than new document. When I get back to my
office tomorrow I will apply the SP3 pack to my MS Word. Not sure if that
alone will make the difference in all of this.

Depending on the project deadline I may just apply the merge to a new
document and then print pdf files from there. Creating new documents for
me
creates a real slow down in my project. I have over 14,000 letters to
merge
from 5 different letter formats. Even though I merge in blocks of 500, the
merge to "new document" is very slow (even with the spell check off).

Anyway, thanks again. Frankly, I'm blown away by your efforts and advice
.
. . much appreciate it!

Peter
ps - I will let you know if I resolve the problem . . .




  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Peter is offline
external usenet poster
 
Posts: 111
Default Word mailmerge how to do multiple If statements

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

  #4   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



  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Peter is offline
external usenet poster
 
Posts: 111
Default Word mailmerge how to do multiple If statements

Hi Peter,

I guess for me, the confusion is where to place the information about the
actual fields in my Gen.doc within the If statement.

I have 4 different documents to begin with; Gen, Gen2, Gen3, Gen4. Within
each document I have 4 merge fields as so:

Name
Addr1
CPP

Sal

. . . . then the body text.

The field "Alert" does not appear in the document but is only used as
reference for type of letter.

So in your example of:

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

I am confused about placement of the acutal data fields used in Gen, Gen2,
Gen3, Gen4, to suppress blank lines.

I will completely understand if you're getting frustrated with trying to get
the concept through my thick skull . . . so feel free to throw your hands up
and proclaim "what an idiot!" . . . lol

Thanks again for your time Peter.

Peter




  #6   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

If you use Alt-F9 to show the field codes in each gen?.doc, you would see
something like

{ MERGEFIELD Name }
{ MERGEFIELD Addr1 }
{ MERGEFIELD CPP }

{ MERGEFIELD Sal }

. . . . then the body text.

Assuming you want each of those MERGEFIELD lines to be removed when they are
blank, you could use

{ IF { MERGEFIELD Name } = ""
"" "{ MERGEFIELD Name }
" }{ IF { MERGEFIELD Addr1 } = ""
"" "{ MERGEFIELD Addr1 }
" }{ IF { MERGEFIELD CPP } = ""
"" "{ MERGEFIELD CPP }
" }

{ IF { MERGEFIELD Sal } = ""
"" "{ MERGEFIELD Sal }
" }
. . . . then the body text.

As I've probably said before, each of the pairs of {} need to be the special
field braces you can insert using ctrl-F9. Everything else is plain text. It
doesn't really matter how you lay out the IF fields as long as there's a
paragraph mark immediately after the { MERGEFIELD } in the result and the
following text follows straight on. e.g. you can use

{ IF { MERGEFIELD Name } = "" "" "{ MERGEFIELD Name }
" }{ IF { MERGEFIELD Addr1 } = "" "" "{ MERGEFIELD Addr1 }
" }{ IF { MERGEFIELD CPP } = "" "" "{ MERGEFIELD CPP }
" }

but not

{ IF { MERGEFIELD Name } = "" "" "{ MERGEFIELD Name }" }{ IF { MERGEFIELD
Addr1 } = "" "" "{ MERGEFIELD Addr1 }" }{ IF { MERGEFIELD CPP } = "" "" "{
MERGEFIELD CPP }" }

or

{ IF { MERGEFIELD Name } = "" "" "{ MERGEFIELD Name }
" }
{ IF { MERGEFIELD Addr1 } = "" "" "{ MERGEFIELD Addr1 }
" }
{ IF { MERGEFIELD CPP } = "" "" "{ MERGEFIELD CPP }
" }

(I usually do it the first way because it has more chance of getting through
these newsgroups unchanged)

Peter Jamieson


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

I guess for me, the confusion is where to place the information about the
actual fields in my Gen.doc within the If statement.

I have 4 different documents to begin with; Gen, Gen2, Gen3, Gen4. Within
each document I have 4 merge fields as so:

Name
Addr1
CPP

Sal

. . . . then the body text.

The field "Alert" does not appear in the document but is only used as
reference for type of letter.

So in your example of:

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

I am confused about placement of the acutal data fields used in Gen, Gen2,
Gen3, Gen4, to suppress blank lines.

I will completely understand if you're getting frustrated with trying to
get
the concept through my thick skull . . . so feel free to throw your hands
up
and proclaim "what an idiot!" . . . lol

Thanks again for your time Peter.

Peter




  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Peter is offline
external usenet poster
 
Posts: 111
Default Word mailmerge how to do multiple If statements

Peter!

Thanks so much! . . . you've cleared up the fog that's been bugging me for
the past few days and got me up at 3:30am this morning . . .

Really appreciate all your efforts and putting up with my "not just getting
it".

I have modified all my documents, Gen, Gen2, Gen3, Gen4, and then tested a
couple of hundred letters. They all turned out great. I required a date to be
right justified on the same line as the Name merge, so played around with
that and got the results I required.

http://img.photobucket.com/albums/v2...rout/Merge.jpg

Have a great day, I know I am with the work you've save me :-)

And a big thanks to you as well Ed and Doug . . .

Peter


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
if statements with dates in mailmerge walkerh Mailmerge 3 April 9th 07 06:17 PM
How do I insert multiple hyperlinks in if, then, else statements? QUCJ Microsoft Word Help 0 September 21st 05 01:52 PM
How do i use multiple IF statements in word 2000? dg Mailmerge 1 August 18th 05 06:24 AM
MERGE: Can I have multiple SET statements based on one IF Bill Anderson Mailmerge 1 February 24th 05 06:03 AM
MERGE: Can I have multiple SET statements based on one IF Bill Anderson Mailmerge 0 February 24th 05 01:27 AM


All times are GMT +1. The time now is 11:13 PM.

Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"