"remove blank lines"+"Mail Merge"

J

John

I've got a mail merge document that has a separate line for some numeric
amounts
(Base Pay, Adjustment, Merit Pay, etc.). The IF-THEN-ELSE statement I am
using works: ({IF {MERGEFIELD} merit_pay} > 0 "Merit ${MERGEFIELD}
merit_pay}"""}
but if merit_pay IS zero, it leaves a blank line in the document. How do I
get it to remove the blank line. The user wants all of the amounts to show,
on separate lines, lined up, but to not show any lines if there is no data on
that line AND she doesn't want the blank line to show either. She wants
subsequent lines to 'float up'.
 
P

Peter Jamieson

You can try smething like the following instead:

{ MERGEFIELD merit_pay \#"'Merit $0.00';'';''" }

(You can adjust the '$0.00' part as necessary)

If you need the field to be inserted with its original formatting then
you need the IF, but if for example you want


A
Merit $whatever
B

when merit_pay > 0 and

A
B

when it perit_pay <= 0, you can use

A{ IF { MERGEFIELD merit_pay } > 0 "
Merit ${ MERGEFIELD merit_pay }" "" }
B

i.e. click enter immediately before the "M" of "Merit to insert a
paragraph mark in the output of the IF field.


Peter Jamieson

http://tips.pjmsn.me.uk
 
M

macropod

Hi John,

You could use:
{IF«merit_pay»> 0 "«merit_pay»¶
"}
or:
{MERGEFIELD merit_pay \# "'Merit $',0.00¶
;;"}
where the '¶' is an actual carriage return or manual line-break.
 
J

John

Peter and macropod,

Thanks. I tried both and I got 'closer' but MS Word 2007 wouldn't always
line the data up properly and other times it would throw an additional '$' on
the line.

I've seen several posts about a feature that perhaps other (prior) versions
of MS Word had and either 2007 hides it or I just can't find it. The feature
I wanted to try was a switch that said "Don't print blank lines". I've
searched high and low and can't seem to find that switch. I'm not saying it
would solve my problem but I would like to turn it on (if it exists in MS
Word 2007).

Many thanks.
--
John


macropod said:
Hi John,

You could use:
{IF«merit_pay»> 0 "«merit_pay»¶
"}
or:
{MERGEFIELD merit_pay \# "'Merit $',0.00¶
;;"}
where the '¶' is an actual carriage return or manual line-break.

--
Cheers
macropod
[MVP - Microsoft Word]


John said:
I've got a mail merge document that has a separate line for some numeric
amounts
(Base Pay, Adjustment, Merit Pay, etc.). The IF-THEN-ELSE statement I am
using works: ({IF {MERGEFIELD} merit_pay} > 0 "Merit ${MERGEFIELD}
merit_pay}"""}
but if merit_pay IS zero, it leaves a blank line in the document. How do I
get it to remove the blank line. The user wants all of the amounts to show,
on separate lines, lined up, but to not show any lines if there is no data on
that line AND she doesn't want the blank line to show either. She wants
subsequent lines to 'float up'.
 
D

Doug Robbins - Word MVP on news.microsoft.com

On the PREVIOUS line, put

{IF {MERGEFIELD merit_pay} > 0 "Merit ${MERGEFIELD merit_pay }" "" }

Then put the cursor between the " and the M of Merit and press Enter so that
with Formatting marks being shown (Press the Show/Hide ¶ button), you see

Previous text { IF { MERGEFIELD merit_pay } > 0 "¶
Merit ${ MERGEFIELDmerit_pay }" "" }

Press Alt+F9 to toggle off the display of the field codes and then execute
the merge.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

John said:
Peter and macropod,

Thanks. I tried both and I got 'closer' but MS Word 2007 wouldn't always
line the data up properly and other times it would throw an additional '$'
on
the line.

I've seen several posts about a feature that perhaps other (prior)
versions
of MS Word had and either 2007 hides it or I just can't find it. The
feature
I wanted to try was a switch that said "Don't print blank lines". I've
searched high and low and can't seem to find that switch. I'm not saying
it
would solve my problem but I would like to turn it on (if it exists in MS
Word 2007).

Many thanks.
--
John


macropod said:
Hi John,

You could use:
{IF«merit_pay»> 0 "«merit_pay»¶
"}
or:
{MERGEFIELD merit_pay \# "'Merit $',0.00¶
;;"}
where the '¶' is an actual carriage return or manual line-break.

--
Cheers
macropod
[MVP - Microsoft Word]


John said:
I've got a mail merge document that has a separate line for some
numeric
amounts
(Base Pay, Adjustment, Merit Pay, etc.). The IF-THEN-ELSE statement I
am
using works: ({IF {MERGEFIELD} merit_pay} > 0 "Merit ${MERGEFIELD}
merit_pay}"""}
but if merit_pay IS zero, it leaves a blank line in the document. How
do I
get it to remove the blank line. The user wants all of the amounts to
show,
on separate lines, lined up, but to not show any lines if there is no
data on
that line AND she doesn't want the blank line to show either. She
wants
subsequent lines to 'float up'.
 
P

Peter Jamieson

In Word 2007 the option is set to "Don't print blank lines" by default.

But you can modify the setting either by putting the old Mail Merge
Helper in the QAT (Word Office Button->Word Options->Customize->Choose
commands from All Commands, locate Mail Merge Helper and drag it to the
right hand column) and using the third button, or by using VBA to issue

activedocument.MailMerge.SuppressBlankLines = True

(or False!)
Thanks. I tried both and I got 'closer' but MS Word 2007 wouldn't always
line the data up properly and other times it would throw an additional '$' on
the line.

Do you actually have a variety of different formats of amount in your
data source (e.g. some with just 1.23, some with $1.23, etc.?)


Peter Jamieson

http://tips.pjmsn.me.uk
 
J

John

Doug,

Thanks. But it is still not working. I even tried to remove the spaces at
the beginning of the line (which brought the 'columns' of salary data which
were previously indented (on purpose) over to the left and there are still
blank lines between the amounts. The text on the lines don't show- which is
what I want - but the lines themselves still take up a 'line' on the
document.

Peter - if "don't print blank lines" is the default in MS Word 2007 id
doesn't work very well - or MS Word doesn't consider a line with an
IF-THEN-ELSE on it 'truly blank'.

Thanks for your responses.

John


Doug Robbins - Word MVP on news.microsof said:
On the PREVIOUS line, put

{IF {MERGEFIELD merit_pay} > 0 "Merit ${MERGEFIELD merit_pay }" "" }

Then put the cursor between the " and the M of Merit and press Enter so that
with Formatting marks being shown (Press the Show/Hide ¶ button), you see

Previous text { IF { MERGEFIELD merit_pay } > 0 "¶
Merit ${ MERGEFIELDmerit_pay }" "" }

Press Alt+F9 to toggle off the display of the field codes and then execute
the merge.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

John said:
Peter and macropod,

Thanks. I tried both and I got 'closer' but MS Word 2007 wouldn't always
line the data up properly and other times it would throw an additional '$'
on
the line.

I've seen several posts about a feature that perhaps other (prior)
versions
of MS Word had and either 2007 hides it or I just can't find it. The
feature
I wanted to try was a switch that said "Don't print blank lines". I've
searched high and low and can't seem to find that switch. I'm not saying
it
would solve my problem but I would like to turn it on (if it exists in MS
Word 2007).

Many thanks.
--
John


macropod said:
Hi John,

You could use:
{IF«merit_pay»> 0 "«merit_pay»¶
"}
or:
{MERGEFIELD merit_pay \# "'Merit $',0.00¶
;;"}
where the '¶' is an actual carriage return or manual line-break.

--
Cheers
macropod
[MVP - Microsoft Word]


I've got a mail merge document that has a separate line for some
numeric
amounts
(Base Pay, Adjustment, Merit Pay, etc.). The IF-THEN-ELSE statement I
am
using works: ({IF {MERGEFIELD} merit_pay} > 0 "Merit ${MERGEFIELD}
merit_pay}"""}
but if merit_pay IS zero, it leaves a blank line in the document. How
do I
get it to remove the blank line. The user wants all of the amounts to
show,
on separate lines, lined up, but to not show any lines if there is no
data on
that line AND she doesn't want the blank line to show either. She
wants
subsequent lines to 'float up'.
 
P

Peter Jamieson

Peter - if "don't print blank lines" is the default in MS Word 2007 id
doesn't work very well - or MS Word doesn't consider a line with an
IF-THEN-ELSE on it 'truly blank'.

No it doesn't. Nor are you the first person to notice :) "don't print
blank lines" is not a correct description of what is happening at all -
if it was, presumably any blank line would be suppressed in the
document, so clearly Word's code is only doing something special with
lines that have fields on them that happen to end up blank. And even
then, as you say, a line containing an IF field that results in a blank
is not suppressed. Further, in recent versions of Word, even lines that
would have been suppressed in earlier versions because they contained a
single merge field whose result is blank are not suppressed if they are
nested inside other fields sch as IF or INCLUDETEXT fields. Finally (I
think!) there are differences in behaviour depending on whether you
merge to a new document, preview, or print.

Typical Word, in fact.

But I think it would probably be easier for us if you could provide a
bit more info including a sample of the relevant chunk of your text, as
it looks as if you are trying to do something more complex than our
simple suggestions could possibly deal with. I assumed from an earlier
message that you were trying to output these amounts on seperate lines,
but perhaps that isn't the case...


Peter Jamieson

http://tips.pjmsn.me.uk
Doug,

Thanks. But it is still not working. I even tried to remove the spaces at
the beginning of the line (which brought the 'columns' of salary data which
were previously indented (on purpose) over to the left and there are still
blank lines between the amounts. The text on the lines don't show- which is
what I want - but the lines themselves still take up a 'line' on the
document.

Peter - if "don't print blank lines" is the default in MS Word 2007 id
doesn't work very well - or MS Word doesn't consider a line with an
IF-THEN-ELSE on it 'truly blank'.

Thanks for your responses.

John


Doug Robbins - Word MVP on news.microsof said:
On the PREVIOUS line, put

{IF {MERGEFIELD merit_pay} > 0 "Merit ${MERGEFIELD merit_pay }" "" }

Then put the cursor between the " and the M of Merit and press Enter so that
with Formatting marks being shown (Press the Show/Hide ¶ button), you see

Previous text { IF { MERGEFIELD merit_pay } > 0 "¶
Merit ${ MERGEFIELDmerit_pay }" "" }

Press Alt+F9 to toggle off the display of the field codes and then execute
the merge.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

John said:
Peter and macropod,

Thanks. I tried both and I got 'closer' but MS Word 2007 wouldn't always
line the data up properly and other times it would throw an additional '$'
on
the line.

I've seen several posts about a feature that perhaps other (prior)
versions
of MS Word had and either 2007 hides it or I just can't find it. The
feature
I wanted to try was a switch that said "Don't print blank lines". I've
searched high and low and can't seem to find that switch. I'm not saying
it
would solve my problem but I would like to turn it on (if it exists in MS
Word 2007).

Many thanks.
--
John


:

Hi John,

You could use:
{IF«merit_pay»> 0 "«merit_pay»¶
"}
or:
{MERGEFIELD merit_pay \# "'Merit $',0.00¶
;;"}
where the '¶' is an actual carriage return or manual line-break.

--
Cheers
macropod
[MVP - Microsoft Word]


I've got a mail merge document that has a separate line for some
numeric
amounts
(Base Pay, Adjustment, Merit Pay, etc.). The IF-THEN-ELSE statement I
am
using works: ({IF {MERGEFIELD} merit_pay} > 0 "Merit ${MERGEFIELD}
merit_pay}"""}
but if merit_pay IS zero, it leaves a blank line in the document. How
do I
get it to remove the blank line. The user wants all of the amounts to
show,
on separate lines, lined up, but to not show any lines if there is no
data on
that line AND she doesn't want the blank line to show either. She
wants
subsequent lines to 'float up'.
 
J

John

Peter,

No - they are all currency.

I did 'go back in' (this was this morning after the posts last night)
and set all the either blank or null fields to 0 (which show as $0)
thinking that may have had some effect on it (which, in reality it didn't
as both null and blank are NOT > 0)

John
 
D

Doug Robbins - Word MVP on news.microsoft.com

If you want to send me a copy of the mail merge main document, I will see
what I can do with it.

Send it to (e-mail address removed)

You must delete REMOVECAPS from the email address.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

John said:
Doug,

Thanks. But it is still not working. I even tried to remove the spaces
at
the beginning of the line (which brought the 'columns' of salary data
which
were previously indented (on purpose) over to the left and there are still
blank lines between the amounts. The text on the lines don't show- which
is
what I want - but the lines themselves still take up a 'line' on the
document.

Peter - if "don't print blank lines" is the default in MS Word 2007 id
doesn't work very well - or MS Word doesn't consider a line with an
IF-THEN-ELSE on it 'truly blank'.

Thanks for your responses.

John


Doug Robbins - Word MVP on news.microsof said:
On the PREVIOUS line, put

{IF {MERGEFIELD merit_pay} > 0 "Merit ${MERGEFIELD merit_pay }" "" }

Then put the cursor between the " and the M of Merit and press Enter so
that
with Formatting marks being shown (Press the Show/Hide ¶ button), you see

Previous text { IF { MERGEFIELD merit_pay } > 0 "¶
Merit ${ MERGEFIELDmerit_pay }" "" }

Press Alt+F9 to toggle off the display of the field codes and then
execute
the merge.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

John said:
Peter and macropod,

Thanks. I tried both and I got 'closer' but MS Word 2007 wouldn't
always
line the data up properly and other times it would throw an additional
'$'
on
the line.

I've seen several posts about a feature that perhaps other (prior)
versions
of MS Word had and either 2007 hides it or I just can't find it. The
feature
I wanted to try was a switch that said "Don't print blank lines". I've
searched high and low and can't seem to find that switch. I'm not
saying
it
would solve my problem but I would like to turn it on (if it exists in
MS
Word 2007).

Many thanks.
--
John


:

Hi John,

You could use:
{IF«merit_pay»> 0 "«merit_pay»¶
"}
or:
{MERGEFIELD merit_pay \# "'Merit $',0.00¶
;;"}
where the '¶' is an actual carriage return or manual line-break.

--
Cheers
macropod
[MVP - Microsoft Word]


I've got a mail merge document that has a separate line for some
numeric
amounts
(Base Pay, Adjustment, Merit Pay, etc.). The IF-THEN-ELSE statement
I
am
using works: ({IF {MERGEFIELD} merit_pay} > 0 "Merit ${MERGEFIELD}
merit_pay}"""}
but if merit_pay IS zero, it leaves a blank line in the document.
How
do I
get it to remove the blank line. The user wants all of the amounts
to
show,
on separate lines, lined up, but to not show any lines if there is
no
data on
that line AND she doesn't want the blank line to show either. She
wants
subsequent lines to 'float up'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top