Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
chops chops is offline
external usenet poster
 
Posts: 3
Default Inserting IncludeText within an IF fileld

I am trying to insert IncludeText within an IF Field statement. e.g IF
postcode has CV* then print text A IF not then print text B. Do i have to
also give the IncludeText text a Bookmark referenece?
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Inserting IncludeText within an IF fileld

If you are inserting alternative bookmarked text items from the same
document then you would use something like

{ INCLUDETEXT "D:\\My Documents\\Word Documents\\Doc1.Docx" { IF{ Ref
Postcode } = "CV*" "Text1" "Text2" }}

Which will insert bookmarked item Text1 if the test is true otherwise Text2
Use a Mergefield instead of the REF field as appropriate.

--

Graham Mayor - Word MVP

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




"chops" wrote in message
...
I am trying to insert IncludeText within an IF Field statement. e.g IF
postcode has CV* then print text A IF not then print text B. Do i have to
also give the IncludeText text a Bookmark referenece?



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Pesach Shelnitz[_2_] Pesach Shelnitz[_2_] is offline
external usenet poster
 
Posts: 277
Default Inserting IncludeText within an IF fileld

Hi,

You can use one wildcard (*) in the IF field to do this. For example,

{If {Bookmark1} = "CV*" "A" "B"}

Don't type the curly brackets ({}). You create them by selected the text to
be enclosed and pressing Ctrl+F9. Here Bookmark1 points to the postcode.

--
Hope this helps,
Pesach Shelnitz
My Web site: http://makeofficework.com


"chops" wrote:

I am trying to insert IncludeText within an IF Field statement. e.g IF
postcode has CV* then print text A IF not then print text B. Do i have to
also give the IncludeText text a Bookmark referenece?

  #4   Report Post  
Posted to microsoft.public.word.docmanagement
chops chops is offline
external usenet poster
 
Posts: 3
Default Inserting IncludeText within an IF fileld

Yes thank you. In your statement below i understand that if Bookmark 1 = CV*
then text A is written but if it doesn't = CV* then text B is written.

I am trying to achieve a situation where =CV* text from another document e.g
C:\documents\textA.doc is then written into this space. I am using the
Include text function but it isn't working. My string in the IF field code
box is: IF BM2="CV*" {INCLUDETEXT "C:\documents\textA.doc"} "Error".

I have written many different IncludeText fields in the past and haven't had
any problems but this is a slightly different use of the IF statement in
Fields.

Hope this gives you some better info of what i am trying to achieve.

Thanks



"Pesach Shelnitz" wrote:

Hi,

You can use one wildcard (*) in the IF field to do this. For example,

{If {Bookmark1} = "CV*" "A" "B"}

Don't type the curly brackets ({}). You create them by selected the text to
be enclosed and pressing Ctrl+F9. Here Bookmark1 points to the postcode.

--
Hope this helps,
Pesach Shelnitz
My Web site: http://makeofficework.com


"chops" wrote:

I am trying to insert IncludeText within an IF Field statement. e.g IF
postcode has CV* then print text A IF not then print text B. Do i have to
also give the IncludeText text a Bookmark referenece?

  #5   Report Post  
Posted to microsoft.public.word.docmanagement
chops chops is offline
external usenet poster
 
Posts: 3
Default Inserting IncludeText within an IF fileld

So are you saying within document Doc1.docx you have two bookmark pieces of
text called "text1" and "text2"?

What if you want different paragraphs of text from different documents? Can
this be done?

Thanks

"Graham Mayor" wrote:

If you are inserting alternative bookmarked text items from the same
document then you would use something like

{ INCLUDETEXT "D:\\My Documents\\Word Documents\\Doc1.Docx" { IF{ Ref
Postcode } = "CV*" "Text1" "Text2" }}

Which will insert bookmarked item Text1 if the test is true otherwise Text2
Use a Mergefield instead of the REF field as appropriate.

--

Graham Mayor - Word MVP

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




"chops" wrote in message
...
I am trying to insert IncludeText within an IF Field statement. e.g IF
postcode has CV* then print text A IF not then print text B. Do i have to
also give the IncludeText text a Bookmark referenece?



.



  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Pesach Shelnitz[_2_] Pesach Shelnitz[_2_] is offline
external usenet poster
 
Posts: 277
Default Inserting IncludeText within an IF fileld

Hi,

In the IF statement you must enclose each result in quotation marks, and if
you want the result to be text from another document, rather than the whole
document, you should specify a bookmark from the other document, for example,
a bookmark named TextA. The following modified version of your IF field
should work.

{IF {BM2}="CV*" "{INCLUDETEXT "C:\\documents\\textA.doc" TextA}" "Error"}

Be sure to create all the pairs of curly brackets by selecting and pressing
Ctrl+F9.
--
Hope this helps,
Pesach Shelnitz
My Web site: http://makeofficework.com


"chops" wrote:

Yes thank you. In your statement below i understand that if Bookmark 1 = CV*
then text A is written but if it doesn't = CV* then text B is written.

I am trying to achieve a situation where =CV* text from another document e.g
C:\documents\textA.doc is then written into this space. I am using the
Include text function but it isn't working. My string in the IF field code
box is: IF BM2="CV*" {INCLUDETEXT "C:\documents\textA.doc"} "Error".

I have written many different IncludeText fields in the past and haven't had
any problems but this is a slightly different use of the IF statement in
Fields.

Hope this gives you some better info of what i am trying to achieve.

Thanks



"Pesach Shelnitz" wrote:

Hi,

You can use one wildcard (*) in the IF field to do this. For example,

{If {Bookmark1} = "CV*" "A" "B"}

Don't type the curly brackets ({}). You create them by selected the text to
be enclosed and pressing Ctrl+F9. Here Bookmark1 points to the postcode.

--
Hope this helps,
Pesach Shelnitz
My Web site: http://makeofficework.com


"chops" wrote:

I am trying to insert IncludeText within an IF Field statement. e.g IF
postcode has CV* then print text A IF not then print text B. Do i have to
also give the IncludeText text a Bookmark referenece?

  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Inserting IncludeText within an IF fileld

Hi,

In the IF statement you must enclose each result in quotation marks,

and if
you want the result to be text from another document, rather than the

whole
document, you should specify a bookmark from the other document, for

example,
a bookmark named TextA. The following modified version of your IF field
should work.

{IF {BM2}="CV*" "{INCLUDETEXT "C:\\documents\\textA.doc" TextA}" "Error"}

Be sure to create all the pairs of curly brackets by selecting and

pressing
Ctrl+F9.


FWIW there is slightly more to it than this, e.g.
a. One-off inclusions (e.g. where you execute the { IF } field
manually) should work. But in a mailmerge, the IF field may only be
evaluated once in an output document (i.e. you may have to select the
output document and re-execute the fields). Inverting the nesting so
that you have an IF inside of an INCLUDETEXT, as Graham has suggested,
is sometimes a solution for this problem
b. In the general case it's advisable to surround REF fields by
quotes, e.g.

With
{IF {BM2}="CV*" "{INCLUDETEXT "C:\\documents\\textA.doc" TextA}" "Error"}

If the value of the bookmark BM2 is "mybm" and there happens to be a
bookmark in the document called mybm, instead of comparing
the value of bookmark BM2 with "CV*"
Word will compare
the value of bookmark mybm with "CV*"

If you use
{IF "{BM2}"="CV*" "{INCLUDETEXT "C:\\documents\\textA.doc" TextA}" "Error"}

that particular problem should be avoided.

c. Personally I prefer to surround the "true" and "false" results by
double quotes as you have suggested because
(1) it's a consistent approach that always seems to work and
(2) it's what Microsoft generally seems to have put in their
documentation, i.e. the nearest thing to a "documented syntax" that we have

but that said, it does not appear to be necessary in the cases where a
result consists of a single field, or a single text token.


Peter Jamieson

http://tips.pjmsn.me.uk

On 14/12/2009 20:32, Pesach Shelnitz wrote:
Hi,

In the IF statement you must enclose each result in quotation marks, and if
you want the result to be text from another document, rather than the whole
document, you should specify a bookmark from the other document, for example,
a bookmark named TextA. The following modified version of your IF field
should work.

{IF {BM2}="CV*" "{INCLUDETEXT "C:\\documents\\textA.doc" TextA}" "Error"}

Be sure to create all the pairs of curly brackets by selecting and pressing
Ctrl+F9.

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
includetext Paulo Microsoft Word Help 1 September 24th 08 03:15 PM
INCLUDETEXT SorrentoBob Mailmerge 13 August 20th 08 02:39 PM
IncludeText Help!! Randy Microsoft Word Help 1 May 2nd 08 12:01 PM
using INCLUDETEXT? BrendaLL Microsoft Word Help 2 March 9th 06 06:42 AM
IncludeText Janna Tables 0 February 19th 05 03:35 PM


All times are GMT +1. The time now is 04:16 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"