Delete Blank Lines with Word 2007 Mail Merge

S

SSJ

I have been researching this problem and have not found a good
solution. I attempted to use the IF function which does leave the
line blank, but does not actually delete the line. I am attempting to
merge data into a word file. The data to merge contains a different
number of rows depending on the prospect. Some letters will have 2
pieces of information to mail merge others will have up to 10. After
the portion of the letter that needs data merged the standard letter
continues.

What I would like to do is have the portion of the letter following
the merged data to continue after the last line of merged data. All I
have found to do so far is have a wide area of blank space between the
last merged data and the remaining portion of the letter.

For example if I merge in one letter 2 pieces of data, but it is set
up to hold 10 lines of data I have 8 blank lines between the merge and
remaining portion of the letter. Is there anyway to have the blank
space be dynamic for each letter?

Thanks!
 
D

Doug Robbins - Word MVP

Is the variable number of pieces of data in separate fields in the one
record or do you have multiple records that you want to combine into one
document where each of those records contains data that is common for that
document?

The first certainly can be done with the use of If...then...Else field
constructions, thought setting it up can be a bit monotonous for dealing
with 2, 3, 4, 5, 6, 7, 8, 9 or 10 pieces of data.

For the second, use the method on the following website:

http://cornell.veplan.net/article.aspx?&a=3815


--
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
 
S

SSJ

Is the variable number of pieces of data in separate fields in the one
record or do you have multiple records that you want to combine into one
document where each of those records contains data that is common for that
document?

The first certainly can be done with the use of If...then...Else field
constructions, thought setting it up can be a bit monotonous for dealing
with 2, 3, 4, 5, 6, 7, 8, 9 or 10 pieces of data.

For the second, use the method on the following website:

http://cornell.veplan.net/article.aspx?&a=3815

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









- Show quoted text -

The data records I have are all in one row. The prospects name and
the data I want to merge about the prospect appear in the same row.
There is a possiblity of up to 10 columns of information for each
prospect. Not all prospects have 10 pieces of information. Some only
have 2 and others 8 or 10. When I attempt to set this up in word it
allows for 10 lines of information. In the case of a prospect with
only 2 lines of information there is a huge blank gap between the last
line of merged information and the remaining portion of the letter. I
simply want something that will remove the "gap" moving the remaining
letter up or down depending on the amount of lines needed for the
merged data.

I appreciate your help.
 
D

Doug Robbins - Word MVP

Assuming that the ten fields that may not all contain data are name Opt1,
Opt2, ... Opt10, then use the following field construciton

{ IF { MERGEFIELD Opt1 } <> "" { MERGEFIELD Opt1 } "" }{ IF { MERGEFIELD
Opt2 } <> "" "[ENTER]{ MERGEFIELD Opt2 }" "" }{IF { MERGEFIELD Opt3 } <> ""
"[ENTER]{ MERGEFIELD Opt3 }" "" }{IF { MERGEFIELD Opt4 } <> "" "[ENTER]{
MERGEFIELD Opt4 }" "" }{IF { MERGEFIELD Opt5 } <> "" "[ENTER]{ MERGEFIELD
Opt5 }" "" }{IF { MERGEFIELD Opt6 } <> "" "[ENTER]{ MERGEFIELD Opt6}"
"" }{IF { MERGEFIELD Opt7 } <> "" "[ENTER]{ MERGEFIELD Opt7 }" "" }{IF {
MERGEFIELD Opt8 } <> "" "[ENTER]{ MERGEFIELD Opt8 }" "" }{IF { MERGEFIELD
Opt9 } <> "" "[ENTER]{ MERGEFIELD Opt9 }" "" }{IF { MERGEFIELD Opt10 } <> ""
"[ENTER]{ MERGEFIELD Opt10 }" "" }

You must use Ctrl+F9 to insert each pair of field delimiters and I suggest
that in the first instance, you type [ENTER] whereever it appears above, so
that to begin with, this construction is all in one paragraph. (When you
have entered the { IF { MERGEFIELD Opt2 } <> "" "[ENTER]{ MERGEFIELD Opt2 }"
"" }, you can copy and paste that changing the field name each time)

When you have this all set up in one paragraph, select each [ENTER] in turn
and press the Enter Key to replace it with a carriage return.

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

Is the variable number of pieces of data in separate fields in the one
record or do you have multiple records that you want to combine into one
document where each of those records contains data that is common for that
document?

The first certainly can be done with the use of If...then...Else field
constructions, thought setting it up can be a bit monotonous for dealing
with 2, 3, 4, 5, 6, 7, 8, 9 or 10 pieces of data.

For the second, use the method on the following website:

http://cornell.veplan.net/article.aspx?&a=3815

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









- Show quoted text -

The data records I have are all in one row. The prospects name and
the data I want to merge about the prospect appear in the same row.
There is a possiblity of up to 10 columns of information for each
prospect. Not all prospects have 10 pieces of information. Some only
have 2 and others 8 or 10. When I attempt to set this up in word it
allows for 10 lines of information. In the case of a prospect with
only 2 lines of information there is a huge blank gap between the last
line of merged information and the remaining portion of the letter. I
simply want something that will remove the "gap" moving the remaining
letter up or down depending on the amount of lines needed for the
merged data.

I appreciate your help.
 
S

SSJ

Assuming that the ten fields that may not all contain data are name Opt1,
Opt2, ... Opt10, then use the following field construciton

{ IF { MERGEFIELD Opt1 } <> "" { MERGEFIELD Opt1 } "" }{ IF { MERGEFIELD
Opt2 } <> "" "[ENTER]{ MERGEFIELD Opt2 }" "" }{IF { MERGEFIELD Opt3 } <> ""
"[ENTER]{ MERGEFIELD Opt3 }" "" }{IF { MERGEFIELD Opt4 } <> "" "[ENTER]{
MERGEFIELD Opt4 }" "" }{IF { MERGEFIELD Opt5 } <> "" "[ENTER]{ MERGEFIELD
Opt5 }" "" }{IF { MERGEFIELD Opt6 } <> "" "[ENTER]{ MERGEFIELD Opt6}"
"" }{IF { MERGEFIELD Opt7 } <> "" "[ENTER]{ MERGEFIELD Opt7 }" "" }{IF {
MERGEFIELD Opt8 } <> "" "[ENTER]{ MERGEFIELD Opt8 }" "" }{IF { MERGEFIELD
Opt9 } <> "" "[ENTER]{ MERGEFIELD Opt9 }" "" }{IF { MERGEFIELD Opt10 } <>""
"[ENTER]{ MERGEFIELD Opt10 }" "" }

You must use Ctrl+F9 to insert each pair of field delimiters and I suggest
that in the first instance, you type [ENTER] whereever it appears above, so
that to begin with, this construction is all in one paragraph.  (When you
have entered the { IF { MERGEFIELD Opt2 } <> "" "[ENTER]{ MERGEFIELD Opt2}"
"" }, you can copy and paste that changing the field name each time)

When you have this all set up in one paragraph, select each [ENTER] in turn
and press the Enter Key to replace it with a carriage return.

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


Is the variable number of pieces of data in separate fields in the one
record or do you have multiple records that you want to combine into one
document where each of those records contains data that is common for that
document?
The first certainly can be done with the use of If...then...Else field
constructions, thought setting it up can be a bit monotonous for dealing
with 2, 3, 4, 5, 6, 7, 8, 9 or 10 pieces of data.
For the second, use the method on the following website:
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
- Show quoted text -

The data records I have are all in one row.  The prospects name and
the data I want to merge about the prospect appear in the same row.
There is a possiblity of up to 10 columns of information for each
prospect.  Not all prospects have 10 pieces of information.  Some only
have 2 and others 8 or 10.  When I attempt to set this up in word it
allows for 10 lines of information.  In the case of a prospect with
only 2 lines of information there is a huge blank gap between the last
line of merged information and the remaining portion of the letter.  I
simply want something that will remove the "gap" moving the remaining
letter up or down depending on the amount of lines needed for the
merged data.

I appreciate your help.- Hide quoted text -

- Show quoted text -

Thank you for all your help. I am having one problem. When I select
[Enter] and press the enter key it moves the line down one time (it
does not insert a carriage symbol). This still leaves all the extra
blank lines between the last merged data and remaining letter. Any
ideas?

I don't think I mentioned and maybe this has something to do with the
problem, on each line of merged data there are 4 things to merge on
one line. When I do a {Mergefield "Data1"} I then press tab and do
{Mergefield "Data2"}... etc. Then I complete the code and press
enter. Would the "tab" have anything to do with the issue?

Thanks!
 
S

SSJ

Assuming that the ten fields that may not all contain data are name Opt1,
Opt2, ... Opt10, then use the following field construciton
{ IF { MERGEFIELD Opt1 } <> "" { MERGEFIELD Opt1 } "" }{ IF { MERGEFIELD
Opt2 } <> "" "[ENTER]{ MERGEFIELD Opt2 }" "" }{IF { MERGEFIELD Opt3 } <> ""
"[ENTER]{ MERGEFIELD Opt3 }" "" }{IF { MERGEFIELD Opt4 } <> "" "[ENTER]{
MERGEFIELD Opt4 }" "" }{IF { MERGEFIELD Opt5 } <> "" "[ENTER]{ MERGEFIELD
Opt5 }" "" }{IF { MERGEFIELD Opt6 } <> "" "[ENTER]{ MERGEFIELD Opt6}"
"" }{IF { MERGEFIELD Opt7 } <> "" "[ENTER]{ MERGEFIELD Opt7 }" "" }{IF {
MERGEFIELD Opt8 } <> "" "[ENTER]{ MERGEFIELD Opt8 }" "" }{IF { MERGEFIELD
Opt9 } <> "" "[ENTER]{ MERGEFIELD Opt9 }" "" }{IF { MERGEFIELD Opt10 } <> ""
"[ENTER]{ MERGEFIELD Opt10 }" "" }
You must use Ctrl+F9 to insert each pair of field delimiters and I suggest
that in the first instance, you type [ENTER] whereever it appears above, so
that to begin with, this construction is all in one paragraph.  (Whenyou
have entered the { IF { MERGEFIELD Opt2 } <> "" "[ENTER]{ MERGEFIELD Opt2 }"
"" }, you can copy and paste that changing the field name each time)
When you have this all set up in one paragraph, select each [ENTER] in turn
and press the Enter Key to replace it with a carriage return.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
The data records I have are all in one row.  The prospects name and
the data I want to merge about the prospect appear in the same row.
There is a possiblity of up to 10 columns of information for each
prospect.  Not all prospects have 10 pieces of information.  Some only
have 2 and others 8 or 10.  When I attempt to set this up in word it
allows for 10 lines of information.  In the case of a prospect with
only 2 lines of information there is a huge blank gap between the last
line of merged information and the remaining portion of the letter.  I
simply want something that will remove the "gap" moving the remaining
letter up or down depending on the amount of lines needed for the
merged data.
I appreciate your help.- Hide quoted text -
- Show quoted text -

Thank you for all your help.  I am having one problem.  When I select
[Enter] and press the enter key it moves the line down one time (it
does not insert a carriage symbol).  This still leaves all the extra
blank lines between the last merged data and remaining letter.  Any
ideas?

I don't think I mentioned and maybe this has something to do with the
problem, on each line of merged data there are 4 things to merge on
one line.  When I do a {Mergefield "Data1"} I then press tab and do
{Mergefield "Data2"}... etc.  Then I complete the code and press
enter.  Would the "tab" have anything to do with the issue?

Thanks!- Hide quoted text -

- Show quoted text -

I found the issue, I was putting a space between "". Thanks so much
for all your help! It works perfectly.
 

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