INCLUDETEXT

D

dixie

I am trying to do an INCLUDETEXT in a merge letter, but I am unsure about
the exact syntax. I have read the example on Cindy's site, but can't quite
translate it into reality.

I have made a boilerplate document with paragraphs of text and a bookmark
name for each paragraph I might want to include. The data for the mergemail
document is coming from a text file sent out by Access 2000, which opens the
mergemail main document from pressing a button within Access. The merge
document then looks for a data source file of a particular name (containing
the data sent out from Access). My problem is how do I get the bookmark
name into the merge document so it knows which paragraph I want to include
in the merged letter. It will be done using and if then else construct
based on a Y/N field value in the data sent out.

dixie
 
G

Graham Mayor

A better question would be how do *you* determine which paragraph(s) to use?
Without knowing the criteria it is difficult to suggest a method.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
D

dixie

I have a number of Y/N fields in Access that will determine whether certain
paragraphs are required in a letter.

For example, If fldDeposit = true then I need to include in the merged
document, the paragraph in the boilerplate document that I have labelled
with a bookmark of say 'Deposit'. If it is not true, then the alternative
will simply be blank. There would be another one with a paragraph on
Privacy that would be included in a similar way and another two fields, all
working in a similar way..

I am familiar with the if.. then.. else.. method in a merge document, but
according to what I read, the INCLUDETEXT looks like { INCLUDETEXT
"C:\\DocInfo\\Boiler.doc" { MERGEFIELD CUSTTYPE } } where mergefield
CUSTTYPE holds the name of the bookmark (I got this from Cindy Meister's
excellent website).

What I can't work out is how to get the field that contains the name of the
bookmark to merge when I am sending the fields out from Access. Do I have
to send it from access, or can I just have it worded into the mailmerge
document so that it acts on the value of the Y/N field. I hope that makes
some sense at least.

dixie
 
C

Cindy M -WordMVP-

Hi Dixie,

You're very close. One thing you do need, given how this is constructed, is a
bookmark that holds "nothing" (or a single space). The IncludeText field will
want to pull *something* in, or you get an error, so you need to specify the
empty alternative.

The IncludeText field should then look something like this:

{ INCLUDETEXT
"C:\\DocInfo\\Boiler.doc" { IF { MERGEFIELD CUSTTYPE } <> 0 "BookmarkName"
"AlternateBookmarkName" } }

One important thing you haven't mentioned is the version of Word you're doing
this in. Word 2002/2003 with an OLE DB connection pass Yes/No instead of -1/0
(0 = false = no being the key for the IF test). So, if you test a combination
like the above and always get the "true" result, put the { MERGEFIELD
CUSTTYPE } directly into the document and see if the result is literal Yes or
No text, or -1/0 (or possibly 1/0) combination.
I have a number of Y/N fields in Access that will determine whether certain
paragraphs are required in a letter.

For example, If fldDeposit = true then I need to include in the merged
document, the paragraph in the boilerplate document that I have labelled
with a bookmark of say 'Deposit'. If it is not true, then the alternative
will simply be blank. There would be another one with a paragraph on
Privacy that would be included in a similar way and another two fields, all
working in a similar way..

I am familiar with the if.. then.. else.. method in a merge document, but
according to what I read, the INCLUDETEXT looks like { INCLUDETEXT
"C:\\DocInfo\\Boiler.doc" { MERGEFIELD CUSTTYPE } } where mergefield
CUSTTYPE holds the name of the bookmark (I got this from Cindy Meister's
excellent website).

What I can't work out is how to get the field that contains the name of the
bookmark to merge when I am sending the fields out from Access. Do I have
to send it from access, or can I just have it worded into the mailmerge
document so that it acts on the value of the Y/N field. I hope that makes
some sense at least.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
G

Graham Mayor

Or you could probably do it the other way round eg
{IF {Mergefield fldDeposit} = "Y" "{IncludeText "C:\\DocInfo\\Boiler.doc"
Deposit}"}

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
C

Cindy M -WordMVP-

Hi Graham,
Or you could probably do it the other way round eg
{IF {Mergefield fldDeposit} = "Y" "{IncludeText "C:\\DocInfo\\Boiler.doc"
Deposit}"}
Sometimes. But not always. In Word 95/6 and earlier it definitely did not
work, because Word was designed to update field codes from the innermost
layer, outwards. Because so many people wanted to do "forbidden"
combinations, with the IF field in the outermost layer (it is more
intuitive, after all), Microsoft did something to the way the fields update
so that later version can work this way. But it doesn't always work, which
is why I usually recommend the other way...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
G

Graham Mayor

It should work in recent versions, but I take your point, which is why I
added 'probably' ;)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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