Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Veteran of the software cycles Veteran of the software cycles is offline
external usenet poster
 
Posts: 2
Default Inserting merge code into an If...Then statement

I'm using Word 2003 with an Excel spreadsheet as my data source to create a
merge in a lengthy document. I need an If...Then-type field that will allow
me to have another field code in the Insert This Text area.

Example:

If: "Spouse_Y_N" Is Equal to: "Yes", then insert: [Spouse Name].

Where Spouse Name is also a field pulling from the same Excel spreadsheet.

Any ideas on how I can achieve this?

Thanks in advance.

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Inserting merge code into an If...Then statement

Hi,

In Word:
.. Insert a «Spouse_Y_N» mergefield followed by a «Spouse_Name» mergefield ;
.. select both mergefields and press Ctrl-F9 to enclose them in a new field, thus {«Spouse_Y_N»«Spouse_Name»};
.. fill in around the new field braces thus, paying careful attention to the spacing {IF{«Spouse_Y_N»= "Yes" «Spouse_Name»};
.. position the cursor anywhere in this field and press F9 to update it;
.. run your mailmerge.

If your «Spouse_Y_N» mergefield can contain 'Yes', 'yes', 'Y' or 'y' for a 'Yes response, you'll need to do a bit more work. In this
case, when you forst insert the «Spouse_Y_N» mergefield:
.. select it and press Shift-F9. You should see {MERGEFIELD Spouse_Y_N}
.. add an uppercase switch to it, thus: {MERGEFIELD Spouse_Y_N \* Upper}
.. press F9 to update the field
.. continue as before, except that you code the overall field as {IF{«Spouse_Y_N»= "Y*" «Spouse_Name»}

--
Cheers
macropod
[MVP - Microsoft Word]


"Veteran of the software cycles" . com wrote in message
...
I'm using Word 2003 with an Excel spreadsheet as my data source to create a
merge in a lengthy document. I need an If...Then-type field that will allow
me to have another field code in the Insert This Text area.

Example:

If: "Spouse_Y_N" Is Equal to: "Yes", then insert: [Spouse Name].

Where Spouse Name is also a field pulling from the same Excel spreadsheet.

Any ideas on how I can achieve this?

Thanks in advance.


  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Veteran of the software cycles Veteran of the software cycles is offline
external usenet poster
 
Posts: 2
Default Inserting merge code into an If...Then statement

macropod,
Here's what I did: inserted two merge fields, selected them, pressed
Ctrl-F9, typed "IF{" INSIDE the first bracket, typed ="Yes" between 2 merge
fields.

When I press F9 to update the coding, it immediately runs that sequence,
inserting spouse's name ("Anna Bannana"), rather than leaving the coding.

In my dropdown Insert Word Field list, I don't have an "{IF" code. When I
typed "{IF" outside the first brace, it does not become part of the totalcode
when I press F9, which is why I typed "IF{ inside the first brace.

Many thanks for your help so far.


"macropod" wrote:

Hi,

In Word:
.. Insert a «Spouse_Y_N» mergefield followed by a «Spouse_Name» mergefield ;
.. select both mergefields and press Ctrl-F9 to enclose them in a new field, thus {«Spouse_Y_N»«Spouse_Name»};
.. fill in around the new field braces thus, paying careful attention to the spacing {IF{«Spouse_Y_N»= "Yes" «Spouse_Name»};
.. position the cursor anywhere in this field and press F9 to update it;
.. run your mailmerge.

If your «Spouse_Y_N» mergefield can contain 'Yes', 'yes', 'Y' or 'y' for a 'Yes response, you'll need to do a bit more work. In this
case, when you forst insert the «Spouse_Y_N» mergefield:
.. select it and press Shift-F9. You should see {MERGEFIELD Spouse_Y_N}
.. add an uppercase switch to it, thus: {MERGEFIELD Spouse_Y_N \* Upper}
.. press F9 to update the field
.. continue as before, except that you code the overall field as {IF{«Spouse_Y_N»= "Y*" «Spouse_Name»}

--
Cheers
macropod
[MVP - Microsoft Word]


"Veteran of the software cycles" . com wrote in message
...
I'm using Word 2003 with an Excel spreadsheet as my data source to create a
merge in a lengthy document. I need an If...Then-type field that will allow
me to have another field code in the Insert This Text area.

Example:

If: "Spouse_Y_N" Is Equal to: "Yes", then insert: [Spouse Name].

Where Spouse Name is also a field pulling from the same Excel spreadsheet.

Any ideas on how I can achieve this?

Thanks in advance.



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP on news.microsoft.com Doug Robbins - Word MVP on news.microsoft.com is offline
external usenet poster
 
Posts: 407
Default Inserting merge code into an If...Then statement

If you use Alt+F9 to toggle on the display of the field codes, the field
construction should look like

{ IF { MERGEFIELD Spouse_Y_N } = "Yes" { MERGEFIELD "Spouse Name" } }

where each pair of field delimiters { } was either converted from the
mergefieldname or by using Ctrl+F9

Use Alt+F9 to toggle off the display of the field codes. Pressing F9 to
update the field, may cause it to display the result for the current record
in the data source. If you execute the merge however, you should get the
appropriate result for each record.

--
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, originally posted via msnews.microsoft.com

"Veteran of the software cycles"
. com wrote in message
...
macropod,
Here's what I did: inserted two merge fields, selected them, pressed
Ctrl-F9, typed "IF{" INSIDE the first bracket, typed ="Yes" between 2
merge
fields.

When I press F9 to update the coding, it immediately runs that sequence,
inserting spouse's name ("Anna Bannana"), rather than leaving the coding.

In my dropdown Insert Word Field list, I don't have an "{IF" code. When I
typed "{IF" outside the first brace, it does not become part of the
totalcode
when I press F9, which is why I typed "IF{ inside the first brace.

Many thanks for your help so far.


"macropod" wrote:

Hi,

In Word:
.. Insert a «Spouse_Y_N» mergefield followed by a «Spouse_Name»
mergefield ;
.. select both mergefields and press Ctrl-F9 to enclose them in a new
field, thus {«Spouse_Y_N»«Spouse_Name»};
.. fill in around the new field braces thus, paying careful attention to
the spacing {IF{«Spouse_Y_N»= "Yes" «Spouse_Name»};
.. position the cursor anywhere in this field and press F9 to update it;
.. run your mailmerge.

If your «Spouse_Y_N» mergefield can contain 'Yes', 'yes', 'Y' or 'y' for
a 'Yes response, you'll need to do a bit more work. In this
case, when you forst insert the «Spouse_Y_N» mergefield:
.. select it and press Shift-F9. You should see {MERGEFIELD Spouse_Y_N}
.. add an uppercase switch to it, thus: {MERGEFIELD Spouse_Y_N \* Upper}
.. press F9 to update the field
.. continue as before, except that you code the overall field as
{IF{«Spouse_Y_N»= "Y*" «Spouse_Name»}

--
Cheers
macropod
[MVP - Microsoft Word]


"Veteran of the software cycles"
. com wrote in message
...
I'm using Word 2003 with an Excel spreadsheet as my data source to
create a
merge in a lengthy document. I need an If...Then-type field that will
allow
me to have another field code in the Insert This Text area.

Example:

If: "Spouse_Y_N" Is Equal to: "Yes", then insert: [Spouse Name].

Where Spouse Name is also a field pulling from the same Excel
spreadsheet.

Any ideas on how I can achieve this?

Thanks in advance.





  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Veteran of the software cycles[_2_] Veteran of the software cycles[_2_] is offline
external usenet poster
 
Posts: 1
Default Inserting merge code into an If...Then statement

Hi, guys, I got it to work. Many thanks.



"Doug Robbins - Word MVP on news.microsof" wrote:

If you use Alt+F9 to toggle on the display of the field codes, the field
construction should look like

{ IF { MERGEFIELD Spouse_Y_N } = "Yes" { MERGEFIELD "Spouse Name" } }

where each pair of field delimiters { } was either converted from the
mergefieldname or by using Ctrl+F9

Use Alt+F9 to toggle off the display of the field codes. Pressing F9 to
update the field, may cause it to display the result for the current record
in the data source. If you execute the merge however, you should get the
appropriate result for each record.

--
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, originally posted via msnews.microsoft.com

"Veteran of the software cycles"
. com wrote in message
...
macropod,
Here's what I did: inserted two merge fields, selected them, pressed
Ctrl-F9, typed "IF{" INSIDE the first bracket, typed ="Yes" between 2
merge
fields.

When I press F9 to update the coding, it immediately runs that sequence,
inserting spouse's name ("Anna Bannana"), rather than leaving the coding.

In my dropdown Insert Word Field list, I don't have an "{IF" code. When I
typed "{IF" outside the first brace, it does not become part of the
totalcode
when I press F9, which is why I typed "IF{ inside the first brace.

Many thanks for your help so far.


"macropod" wrote:

Hi,

In Word:
.. Insert a «Spouse_Y_N» mergefield followed by a «Spouse_Name»
mergefield ;
.. select both mergefields and press Ctrl-F9 to enclose them in a new
field, thus {«Spouse_Y_N»«Spouse_Name»};
.. fill in around the new field braces thus, paying careful attention to
the spacing {IF{«Spouse_Y_N»= "Yes" «Spouse_Name»};
.. position the cursor anywhere in this field and press F9 to update it;
.. run your mailmerge.

If your «Spouse_Y_N» mergefield can contain 'Yes', 'yes', 'Y' or 'y' for
a 'Yes response, you'll need to do a bit more work. In this
case, when you forst insert the «Spouse_Y_N» mergefield:
.. select it and press Shift-F9. You should see {MERGEFIELD Spouse_Y_N}
.. add an uppercase switch to it, thus: {MERGEFIELD Spouse_Y_N \* Upper}
.. press F9 to update the field
.. continue as before, except that you code the overall field as
{IF{«Spouse_Y_N»= "Y*" «Spouse_Name»}

--
Cheers
macropod
[MVP - Microsoft Word]


"Veteran of the software cycles"
. com wrote in message
...
I'm using Word 2003 with an Excel spreadsheet as my data source to
create a
merge in a lengthy document. I need an If...Then-type field that will
allow
me to have another field code in the Insert This Text area.

Example:

If: "Spouse_Y_N" Is Equal to: "Yes", then insert: [Spouse Name].

Where Spouse Name is also a field pulling from the same Excel
spreadsheet.

Any ideas on how I can achieve this?

Thanks in advance.






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
MS Word 2003 Case statement code [email protected] Microsoft Word Help 4 December 28th 06 05:18 PM
post code moves when inserting address into envelope or label Daniel Cahane New Users 9 May 15th 06 12:35 PM
why do I get embeded code on my document when inserting a chart JAMES62 New Users 1 March 18th 06 06:36 PM
Including a Merge Code Within an IF Statement bk Mailmerge 1 October 4th 05 06:06 AM


All times are GMT +1. The time now is 07:38 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"