View Single Post
  #28   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Mergefields, IF statements and section breaks

If the filename has spaces then the spaces must remain in the field.

Forget the merge for a moment.
Does {INCLUDETEXT "J:\\Dept\\staff\\2009\\letter_Page_3.doc"}
or
{INCLUDETEXT "J:\\Dept\\staff\\2009\\letter Page 3.doc"}
insert the document?

If it does not, check the path and filename are correct.

Once you have the insertion working, you can add the field to your merge
document

{IF {MERGEFIELD course} = "Course D" "{INCLUDETEXT
"J:\\Dept\\staff\\2009\\letter_Page_3.doc"}" ""}

Note that in the above which I have pasted from your question, you have
smart quotes around Course D. You need to change those for straight quotes
thus

{IF {MERGEFIELD course} = "Course D" "{INCLUDETEXT
"J:\\Dept\\staff\\2009\\letter_Page_3.doc"}" ""}

Your next page break needs to go inside the quotes around the Includetext
field

"HERE{INCLUDETEXT "J:\\Dept\\staff\\2009\\letter_Page_3.doc"}OR HERE" ""}

You may also need to merge to a new document and update the fields in that
new document in order to display the inserted document.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org





Nicole Knapp wrote:
I have read this entire thread with interest because I am trying to do
something similar, though more simple.

I have a document that uses a mail merge. I created the IF
statement, with the INSERTTEXT field and a next page break. But it
will not open the file.

The file is buried pretty deep on a network server - but in the same
folder as the original document.
Both documents and folders leading to the documents have spaces in
their filenames. I tried replacing the spaces with underscores - but
no luck.

This is my statement:
{IF {MERGEFIELD course} = "Course D" "{INCLUDETEXT
"J:\\Dept\\staff\\2009\\letter_Page_3.doc"}" ""}

I am using the letter drive, not the network drive name.
Thanks
Nik