INCLUDETEXT File is Determined by Merge Field

C

Clint Marshall

I'm trying to create a Mail Merge where I get my merge fields from an
Access Query. I'm using Word XP and Access XP.
Several items that I want to merge are actually large sections of
"boilerplate" text that exist as their own Word Documents (picture a lease
with sections of boilerplate specific to each property being leased).
How can I specify in/to the merge which piece of boilerplate (which word
document) to merge in? The fields in Access could be text fields or
hyperlinks, of the form: "S:\Forms\Lease Forms\lsefrms\5MILK.DOC".
I've tried various formats, such as: "{INCLUDETEXT {MERGEFIELD
linktofile}\* MERGEFORMAT}", but get an error of: "Error! Filename not
specified.".
I used to do this with fields full of "If" statements in the merge
document, but this is what I'm trying to get away from by moving to an
Access Query. Is there any way to do a merge and include the contents of
another Word document?
Thank you for any thoughts!

-Clint Marshall
 
P

Peter Jamieson

{ INCLUDETEXT "{ MERGEFIELD linktofile }" }

should be enough, but
a. all the {} have to be the field braces you can insert using ctrl-F9
b. you may need to double up all the backslashes in the file names to make
it work (I believe this varies depending on the version of Word and
Windows).
c. Access hyperlink fields probably won't work as they have a format
something like

displaytext#linktext

You can extract the linktext in an Access query - e.g. if the hyperlink
column is called h, your query SQL could be something like

SELECT Mid(h, instr(1, h, '#') + 1, Len(h) - instr(1,h,'#') - 1) as
hyperurl, * FROM mytable

Other things you may be able to consider are:
just putting a filename (not a pathname) in the data source, and
hard-coding the rest of the pathname in the document, e.g.

{ INCLUDETEXT "S:\\Forms\\Lease Forms\\lsefrms\\"{ MERGEFIELD
myfilename }" }

or putting all your texts in a single Word file and bookmarking the sections
you need, e.g.

{ INCLUDETEXT "S:\\Forms\\Lease Forms\\lsefrms\\myfile.doc" "{ MERGEFIELD
mybookmarkname }" }


Peter Jamieson
 
C

Clint Marshall

Thank you, Peter.

Lots of good ideas, none of which quite worked.

In the end, I've had to include four backslashes to make it work - no idea
why! But it's running now!

Thanks!
 

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