Using Includetext to pull in file with merge fields

M

moodyjudy

I am setting up several conditions in a mail merge file using the Includetext
field within an If then else statement. The file that I am pulling in with
the Includetext field has mergefields set up as an inside address of a
letter. (Name, Title, Address1, address2,citystzip). I have set up both
files as merge files and if there is no title in one of the records, it will
not leave a blank line in the orginal file. However, when it pulls into my
main merge file, that feature does not work and I get blank lines when one of
the fields is empty. I cannot find any switches to appky that deal with this
issue.

Has anyone had this problem or knows how to fix it? Thank you
 
P

Peter Jamieson

This is a known problem in relatively recent versions of Word (more
generally, the feature to "suppress blank lines" no longer works with
fields that are nested inside other fields. more or less).

So unfortunately you have to do your own suppression by using e.g.

{ IF "{ MERGEFIELD Name }" = ""
"
{ MERGEFIELD Name }" }{ IF "{ MERGEFIELD Title }" = ""
"
{ MERGEFIELD Title }" }{ IF "{ MERGEFIELD Address }" = ""
"
{ MERGEFIELD Address }" }

i.e. if the field is blank, you do not insert anything, but if it is
non-blank, you insert a new paragraph followed by the field.

Peter Jamieson

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

moodyjudy

Thanks for letting me know this doesn't work so I know it is not just me.
However, I have tried following your instructions and still no success. Do I
use the If the Else command? I tried this leaving the first blank but when I
putin the new paragraph and the field, it just separated my lines with a
double line rather than just a single line. Am I inputting it incorrectly?
 
P

Peter Jamieson

I would insert the field codes directly into your document (i.e. don't
use the "insert word field" facility), using ctrl-F9 to enter each of
the special field code brace pairs {} and the keyboard to type
everything else between,


Peter Jamieson

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

moodyjudy

Still no luck. I tried to paste what I typed in using the Ctrl+F9 key but it
would not show up in this reply. When I turn off the field codes, it doesn't
pull in any fields at all.

Any other suggestions would be appreciated. Thanks
 
D

Doug Robbins - Word MVP

Use

{ MERGEFIELD Name }¶
{ IF { MERGEFIELD Title } = "" "{ MERGEFIELD Address1 }" "{ MERGEFIELD
Title }¶
{ MERGEFIELD Address 1 }" }¶
{ MERGEFIELD Address 2 }¶
etc.

Press Enter or Shift+Enter where ever a ¶ appears in teh above construction

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

moodyjudy

After trying several of these suggestions, I decided to test the merge insead
of just view the data in the main merge file. When I ran the actual mail
merge to a new document, it worked correctly by eliminating the blank lines
when the field was blank.

So I wanted to come back and document this for anyone who has this problem
in the future - when you use the INCLUDETEXT field to nest one merge file
into another, it will appear in the main merge document that it is leaving
blank lines. However, when you run the merge, it works. So I ended up not
changeing my basic mergefield code in the first document at all.

Thanks for the help.

Moodyjudy
 
D

Doug Robbins - Word MVP

Thanks for getting back with this information. We'll have to remember to
ask people if they have actually executed 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
 

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