A Microsoft Word forum. Microsoft Office Word Forum - WordBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Microsoft Office Word Forum - WordBanter forum » Microsoft Word Newsgroups » Microsoft Word Help
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Mail merge question If Statements



 
 
Thread Tools Display Modes
  #1  
Old January 25th 08, 05:01 PM posted to microsoft.public.word.docmanagement
JAnderson
external usenet poster
 
Posts: 21
Default Mail merge question If Statements

I'll try to be clear here. Two questions.

1) I want a boolean operator in an IF statement, is this possible? Example:

{if{MERGEFIELD "MAT_Movie"}= “Rain*” "(true)" "(false)"}

I want to catch all fields that begin with "Rain", such as "Rainy" "Rain
Man", etc.

2) THEN, for the true condition, I want to have an entire formatted page
appear (such as a generic order form). If false, I'd like to leave it blank
and NOT include the order form. Can I just paste the entire page I want into
the true condition "" quotes? Otherwise, would I have to reference a file to
import at that space?

Thanks in advance for any suggestions!

Ads
  #2  
Old January 26th 08, 08:30 AM posted to microsoft.public.word.docmanagement
Graham Mayor
external usenet poster
 
Posts: 19,312
Default Mail merge question If Statements

With a couple of minor provisos this will work.
1. Don't use smart quotes in the search string
2. Convert the result to lower case to be sure of catching all.
3. You can either paste the whole page between the quotes where you have
"(true)" or use an includetext field (as shown) or autotext field.

{ IF{ Mergefield MAT_Movie \*Lower} = "rain*" "{ INCLUDETEXT
"C:\\PATH\\DOCUMENT.DOC"}" "" }

Use CTRL+F9 for each field bracket pair.

--

Graham Mayor - Word MVP

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


JAnderson wrote:
I'll try to be clear here. Two questions.

1) I want a boolean operator in an IF statement, is this possible?
Example:

{if{MERGEFIELD "MAT_Movie"}= "Rain*" "(true)" "(false)"}

I want to catch all fields that begin with "Rain", such as "Rainy"
"Rain Man", etc.

2) THEN, for the true condition, I want to have an entire formatted
page appear (such as a generic order form). If false, I'd like to
leave it blank and NOT include the order form. Can I just paste the
entire page I want into the true condition "" quotes? Otherwise,
would I have to reference a file to import at that space?

Thanks in advance for any suggestions!



  #3  
Old January 28th 08, 04:33 PM posted to microsoft.public.word.docmanagement
JAnderson
external usenet poster
 
Posts: 21
Default Mail merge question If Statements

That is VERY helpful, thank you. Now, if I use the INCLUDETEXT function,
will it bring in the entire document's formatting, or just the literal text
itself? I searched online for a long time and couldn't figure that part out.

Thanks again for all the help!

"Graham Mayor" wrote:

With a couple of minor provisos this will work.
1. Don't use smart quotes in the search string
2. Convert the result to lower case to be sure of catching all.
3. You can either paste the whole page between the quotes where you have
"(true)" or use an includetext field (as shown) or autotext field.

{ IF{ Mergefield MAT_Movie \*Lower} = "rain*" "{ INCLUDETEXT
"C:\\PATH\\DOCUMENT.DOC"}" "" }

Use CTRL+F9 for each field bracket pair.

--

Graham Mayor - Word MVP

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


JAnderson wrote:
I'll try to be clear here. Two questions.

1) I want a boolean operator in an IF statement, is this possible?
Example:

{if{MERGEFIELD "MAT_Movie"}= "Rain*" "(true)" "(false)"}

I want to catch all fields that begin with "Rain", such as "Rainy"
"Rain Man", etc.

2) THEN, for the true condition, I want to have an entire formatted
page appear (such as a generic order form). If false, I'd like to
leave it blank and NOT include the order form. Can I just paste the
entire page I want into the true condition "" quotes? Otherwise,
would I have to reference a file to import at that space?

Thanks in advance for any suggestions!




  #4  
Old January 29th 08, 08:17 AM posted to microsoft.public.word.docmanagement
Graham Mayor
external usenet poster
 
Posts: 19,312
Default Mail merge question If Statements

If you add a mergeformat switch eg

{ IF{ Mergefield MAT_Movie \*Lower} = "rain*" "{ INCLUDETEXT
"C:\\PATH\\DOCUMENT.DOC" \*Mergeformat}" "" }

it will make a fair stab at inserting the original document c/w header
footer information, however it will not insert the original documents
margins and if the styles used in the inserted document conflict with the
styles used in the target document there may well be some anomalies. The
best bet is to try it and see and preferably use documents based on the same
template.

If you want it to adapt to the formatting of the target document (inserting
the literal text), which would seem more logical in the circumstances, use
instead a \*charformat switch. Note you can insert bookmarked parts of a
document too, so you can have all your insertions from the one document.

--

Graham Mayor - Word MVP

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



JAnderson wrote:
That is VERY helpful, thank you. Now, if I use the INCLUDETEXT
function, will it bring in the entire document's formatting, or just
the literal text itself? I searched online for a long time and
couldn't figure that part out.

Thanks again for all the help!

"Graham Mayor" wrote:

With a couple of minor provisos this will work.
1. Don't use smart quotes in the search string
2. Convert the result to lower case to be sure of catching all.
3. You can either paste the whole page between the quotes where you
have "(true)" or use an includetext field (as shown) or autotext
field.

{ IF{ Mergefield MAT_Movie \*Lower} = "rain*" "{ INCLUDETEXT
"C:\\PATH\\DOCUMENT.DOC"}" "" }

Use CTRL+F9 for each field bracket pair.

--

Graham Mayor - Word MVP

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


JAnderson wrote:
I'll try to be clear here. Two questions.

1) I want a boolean operator in an IF statement, is this possible?
Example:

{if{MERGEFIELD "MAT_Movie"}= "Rain*" "(true)" "(false)"}

I want to catch all fields that begin with "Rain", such as "Rainy"
"Rain Man", etc.

2) THEN, for the true condition, I want to have an entire formatted
page appear (such as a generic order form). If false, I'd like to
leave it blank and NOT include the order form. Can I just paste the
entire page I want into the true condition "" quotes? Otherwise,
would I have to reference a file to import at that space?

Thanks in advance for any suggestions!



  #5  
Old January 29th 08, 04:52 PM posted to microsoft.public.word.docmanagement
JAnderson
external usenet poster
 
Posts: 21
Default Mail merge question If Statements

So is that what the \* Mergeformat switch does? If I use Word's 'insert'
function, it always adds that \* Mergeformat at the end of everything.
Nothing I read online makes good sense of when that should be used, and when
it is superfluous.

Thanks again for the help!

"Graham Mayor" wrote:

If you add a mergeformat switch eg

{ IF{ Mergefield MAT_Movie \*Lower} = "rain*" "{ INCLUDETEXT
"C:\\PATH\\DOCUMENT.DOC" \*Mergeformat}" "" }

it will make a fair stab at inserting the original document c/w header
footer information, however it will not insert the original documents
margins and if the styles used in the inserted document conflict with the
styles used in the target document there may well be some anomalies. The
best bet is to try it and see and preferably use documents based on the same
template.

If you want it to adapt to the formatting of the target document (inserting
the literal text), which would seem more logical in the circumstances, use
instead a \*charformat switch. Note you can insert bookmarked parts of a
document too, so you can have all your insertions from the one document.

--

Graham Mayor - Word MVP

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



JAnderson wrote:
That is VERY helpful, thank you. Now, if I use the INCLUDETEXT
function, will it bring in the entire document's formatting, or just
the literal text itself? I searched online for a long time and
couldn't figure that part out.

Thanks again for all the help!

"Graham Mayor" wrote:

With a couple of minor provisos this will work.
1. Don't use smart quotes in the search string
2. Convert the result to lower case to be sure of catching all.
3. You can either paste the whole page between the quotes where you
have "(true)" or use an includetext field (as shown) or autotext
field.

{ IF{ Mergefield MAT_Movie \*Lower} = "rain*" "{ INCLUDETEXT
"C:\\PATH\\DOCUMENT.DOC"}" "" }

Use CTRL+F9 for each field bracket pair.

--

Graham Mayor - Word MVP

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


JAnderson wrote:
I'll try to be clear here. Two questions.

1) I want a boolean operator in an IF statement, is this possible?
Example:

{if{MERGEFIELD "MAT_Movie"}= "Rain*" "(true)" "(false)"}

I want to catch all fields that begin with "Rain", such as "Rainy"
"Rain Man", etc.

2) THEN, for the true condition, I want to have an entire formatted
page appear (such as a generic order form). If false, I'd like to
leave it blank and NOT include the order form. Can I just paste the
entire page I want into the true condition "" quotes? Otherwise,
would I have to reference a file to import at that space?

Thanks in advance for any suggestions!




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge if... then statements aaron Mailmerge 1 October 13th 06 06:08 PM
Mail-Merge question Roger G. New Users 1 August 5th 05 02:20 PM
How can I write IF statements in Mail Merge Sayali Mailmerge 3 March 4th 05 08:31 AM
Mail Merge If Statements (Word 02) Tab Mailmerge 1 March 4th 05 08:01 AM
Using Hyperlinks in Mail Merge IF...THEN...ELSE Statements Mark V Mailmerge 8 November 30th 04 01:31 PM


All times are GMT +1. The time now is 02:19 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright 2004-2020 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.