Require an If Mergefield Statement to import text into word2007 fi

B

Briza

Trying to write an if statement in word2007 for a mergefield whereby if
mergefield = "good" then insert the text (which is about 500 characters) from
a word document located at c:\good.docx and if mergefield = "bad" then insert
the text (which is also about 500 characters) from a word document located at
c:\bad.docx

Can someone please write the if statement to do this?

Alternatively, could i use a notepad document instead of a word document to
import text from (eg good.txt and bad.txt).
Thanks in advance
 
D

Doug Robbins - Word MVP

{ IF { MERGEFIELD "fieldname" } = "good" { INCLUDETEXT "c:\\good.docx" } {
INCLUDETEXT "c:\\bad.docx" } }

You must use Ctrl+F9 to insert each pair of field delimiters { }

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

Briza

Thank you for the reply however it is not working.
Is it supposed to have 2 \\ for the location becuase I thought it would just
be c:\good.docx

Also can I use a notepad document instead (ie. .txt file)?
Thanks again.
 
D

Doug Robbins - Word MVP

You need either two \\ or one /

You should also be able to use a notepad (.txt) file.

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

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