Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / November 2007

Tip: Looking for answers? Try searching our database.

Require an If Mergefield Statement to import text into word2007 fi

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Briza - 08 Nov 2007 06:03 GMT
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
Doug Robbins - Word MVP - 08 Nov 2007 06:19 GMT
{ IF { MERGEFIELD "fieldname" } = "good" { INCLUDETEXT "c:\\good.docx" } {
INCLUDETEXT "c:\\bad.docx" } }

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

Signature

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

> Trying to write an if statement in word2007 for a mergefield whereby if
> mergefield = "good" then insert the text (which is about 500 characters)
[quoted text clipped - 11 lines]
> import text from (eg good.txt and bad.txt).
> Thanks in advance
Briza - 08 Nov 2007 23:12 GMT
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.

> { IF { MERGEFIELD "fieldname" } = "good" { INCLUDETEXT "c:\\good.docx" } {
> INCLUDETEXT "c:\\bad.docx" } }
[quoted text clipped - 16 lines]
> > import text from (eg good.txt and bad.txt).
> > Thanks in advance
Doug Robbins - Word MVP - 09 Nov 2007 02:30 GMT
You need either two \\ or one /

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

Signature

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

> Thank you for the reply however it is not working.
> Is it supposed to have 2 \\ for the location becuase I thought it would
[quoted text clipped - 28 lines]
>> > import text from (eg good.txt and bad.txt).
>> > Thanks in advance
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.