Home |
Search |
Today's Posts |
#1
|
|||
|
|||
If ...elseif ...elseif ....then statements
How do I code multi-else's using mail merge? Example: I want whatever is
City to be Ucase, but evidently I can't use VBA code in mail merges, so I can figure out how to make Seattle capitalized if City = Seattle, but how do I add other cities? I have tried, but only get City instead of TUCSON: {IF {MERGEFIELD City}= Seattle "SEATTLE" {IF{MERGEFIELD City} = Tucson "TUCSON"} ""} If City one of my "defined" cities, can I just merge, and let the field stop and let the user manually type in (capitalized) City? I hope my question is clear. TIA. |
#2
|
|||
|
|||
You want the City in CAPs correct?
Try {Mergefield City \* UPPER } -- Greg Maxey/Word MVP A Peer in Peer to Peer Support zSplash wrote: How do I code multi-else's using mail merge? Example: I want whatever is City to be Ucase, but evidently I can't use VBA code in mail merges, so I can figure out how to make Seattle capitalized if City = Seattle, but how do I add other cities? I have tried, but only get City instead of TUCSON: {IF {MERGEFIELD City}= Seattle "SEATTLE" {IF{MERGEFIELD City} = Tucson "TUCSON"} ""} If City one of my "defined" cities, can I just merge, and let the field stop and let the user manually type in (capitalized) City? I hope my question is clear. TIA. |
#3
|
|||
|
|||
Thanks so much.
st. "Greg Maxey" wrote in message ... You want the City in CAPs correct? Try {Mergefield City \* UPPER } -- Greg Maxey/Word MVP A Peer in Peer to Peer Support zSplash wrote: How do I code multi-else's using mail merge? Example: I want whatever is City to be Ucase, but evidently I can't use VBA code in mail merges, so I can figure out how to make Seattle capitalized if City = Seattle, but how do I add other cities? I have tried, but only get City instead of TUCSON: {IF {MERGEFIELD City}= Seattle "SEATTLE" {IF{MERGEFIELD City} = Tucson "TUCSON"} ""} If City one of my "defined" cities, can I just merge, and let the field stop and let the user manually type in (capitalized) City? I hope my question is clear. TIA. |
#4
|
|||
|
|||
But, can I have multi-elses? I tried, and got error: Unknown op code for
conditional: {IF{MERGEFIELD Office}=1 "Seattle" {IF{MERGEFIELD Office}=2 "Portland" {IF{MERGEFIELD Office}=3 "Fresno" {IF{MERGEFIELD Office}=4 "Tucson"} I see that there are more left wavy brackets than right ones, and that I haven't concluded the equation (what if not 1, 2, 3, or 4), but I don't understand. Could someone help or direct me to a good rudimentary explanation? TIA "Greg Maxey" wrote in message ... You want the City in CAPs correct? Try {Mergefield City \* UPPER } -- Greg Maxey/Word MVP A Peer in Peer to Peer Support zSplash wrote: How do I code multi-else's using mail merge? Example: I want whatever is City to be Ucase, but evidently I can't use VBA code in mail merges, so I can figure out how to make Seattle capitalized if City = Seattle, but how do I add other cities? I have tried, but only get City instead of TUCSON: {IF {MERGEFIELD City}= Seattle "SEATTLE" {IF{MERGEFIELD City} = Tucson "TUCSON"} ""} If City one of my "defined" cities, can I just merge, and let the field stop and let the user manually type in (capitalized) City? I hope my question is clear. TIA. |
#5
|
|||
|
|||
Yes you can have multiple IF conditions.
{ IF { Test }="1""SEATLLE"{ IF{ Test }="2""PORTLAND"{ IF { Test }="3""FRESNO"}}} -- Greg Maxey/Word MVP A Peer in Peer to Peer Support zSplash wrote: But, can I have multi-elses? I tried, and got error: Unknown op code for conditional: {IF{MERGEFIELD Office}=1 "Seattle" {IF{MERGEFIELD Office}=2 "Portland" {IF{MERGEFIELD Office}=3 "Fresno" {IF{MERGEFIELD Office}=4 "Tucson"} I see that there are more left wavy brackets than right ones, and that I haven't concluded the equation (what if not 1, 2, 3, or 4), but I don't understand. Could someone help or direct me to a good rudimentary explanation? TIA "Greg Maxey" wrote in message ... You want the City in CAPs correct? Try {Mergefield City \* UPPER } -- Greg Maxey/Word MVP A Peer in Peer to Peer Support zSplash wrote: How do I code multi-else's using mail merge? Example: I want whatever is City to be Ucase, but evidently I can't use VBA code in mail merges, so I can figure out how to make Seattle capitalized if City = Seattle, but how do I add other cities? I have tried, but only get City instead of TUCSON: {IF {MERGEFIELD City}= Seattle "SEATTLE" {IF{MERGEFIELD City} = Tucson "TUCSON"} ""} If City one of my "defined" cities, can I just merge, and let the field stop and let the user manually type in (capitalized) City? I hope my question is clear. TIA. |
#6
|
|||
|
|||
zSpash,
Sorry for the clipped reply earlier. My wife was assigning me a chore :-) You can nest the additional conditions as I showed you in my last post (replace Test with your mergefield name) or in this case you can simply gang them together {IF{TEST}="1""SEATTLE"}{IF{TEST}="2""PORTLAND"} etc. -- Greg Maxey/Word MVP A Peer in Peer to Peer Support zSplash wrote: But, can I have multi-elses? I tried, and got error: Unknown op code for conditional: {IF{MERGEFIELD Office}=1 "Seattle" {IF{MERGEFIELD Office}=2 "Portland" {IF{MERGEFIELD Office}=3 "Fresno" {IF{MERGEFIELD Office}=4 "Tucson"} I see that there are more left wavy brackets than right ones, and that I haven't concluded the equation (what if not 1, 2, 3, or 4), but I don't understand. Could someone help or direct me to a good rudimentary explanation? TIA "Greg Maxey" wrote in message ... You want the City in CAPs correct? Try {Mergefield City \* UPPER } -- Greg Maxey/Word MVP A Peer in Peer to Peer Support zSplash wrote: How do I code multi-else's using mail merge? Example: I want whatever is City to be Ucase, but evidently I can't use VBA code in mail merges, so I can figure out how to make Seattle capitalized if City = Seattle, but how do I add other cities? I have tried, but only get City instead of TUCSON: {IF {MERGEFIELD City}= Seattle "SEATTLE" {IF{MERGEFIELD City} = Tucson "TUCSON"} ""} If City one of my "defined" cities, can I just merge, and let the field stop and let the user manually type in (capitalized) City? I hope my question is clear. TIA. |
#7
|
|||
|
|||
Thanks, Greg. Your earlier example was fine.
So, now I wonder, can I compare 3 fields from the data source and based on the comparison, "get" one of the fields? (That is, consider 3 unique fields: num3, num2, num1. If num3 is empty, check num2; if num2 is empty, "get" num1.) Do I use "IF THEN" or something else? It's just a little sad trying to "get the syntax (i.e., the demanded # of curly braces, etc.)" for the mail merge Word fields when things are so straight-forward in VBA. TIA "Greg Maxey" wrote in message ... zSpash, Sorry for the clipped reply earlier. My wife was assigning me a chore :-) You can nest the additional conditions as I showed you in my last post (replace Test with your mergefield name) or in this case you can simply gang them together {IF{TEST}="1""SEATTLE"}{IF{TEST}="2""PORTLAND"} etc. -- Greg Maxey/Word MVP A Peer in Peer to Peer Support zSplash wrote: But, can I have multi-elses? I tried, and got error: Unknown op code for conditional: {IF{MERGEFIELD Office}=1 "Seattle" {IF{MERGEFIELD Office}=2 "Portland" {IF{MERGEFIELD Office}=3 "Fresno" {IF{MERGEFIELD Office}=4 "Tucson"} I see that there are more left wavy brackets than right ones, and that I haven't concluded the equation (what if not 1, 2, 3, or 4), but I don't understand. Could someone help or direct me to a good rudimentary explanation? TIA "Greg Maxey" wrote in message ... You want the City in CAPs correct? Try {Mergefield City \* UPPER } -- Greg Maxey/Word MVP A Peer in Peer to Peer Support zSplash wrote: How do I code multi-else's using mail merge? Example: I want whatever is City to be Ucase, but evidently I can't use VBA code in mail merges, so I can figure out how to make Seattle capitalized if City = Seattle, but how do I add other cities? I have tried, but only get City instead of TUCSON: {IF {MERGEFIELD City}= Seattle "SEATTLE" {IF{MERGEFIELD City} = Tucson "TUCSON"} ""} If City one of my "defined" cities, can I just merge, and let the field stop and let the user manually type in (capitalized) City? I hope my question is clear. TIA. |
#8
|
|||
|
|||
zSplash, Not tested, but try something like: { IF { NUM1 }""{ NUM1 }{ IF{ NUM2 }""{ NUM2 }{ NUM3}}} -- Greg Maxey/Word MVP A Peer in Peer to Peer Support zSplash wrote: Thanks, Greg. Your earlier example was fine. So, now I wonder, can I compare 3 fields from the data source and based on the comparison, "get" one of the fields? (That is, consider 3 unique fields: num3, num2, num1. If num3 is empty, check num2; if num2 is empty, "get" num1.) Do I use "IF THEN" or something else? It's just a little sad trying to "get the syntax (i.e., the demanded # of curly braces, etc.)" for the mail merge Word fields when things are so straight-forward in VBA. TIA "Greg Maxey" wrote in message ... zSpash, Sorry for the clipped reply earlier. My wife was assigning me a chore :-) You can nest the additional conditions as I showed you in my last post (replace Test with your mergefield name) or in this case you can simply gang them together {IF{TEST}="1""SEATTLE"}{IF{TEST}="2""PORTLAND"} etc. -- Greg Maxey/Word MVP A Peer in Peer to Peer Support zSplash wrote: But, can I have multi-elses? I tried, and got error: Unknown op code for conditional: {IF{MERGEFIELD Office}=1 "Seattle" {IF{MERGEFIELD Office}=2 "Portland" {IF{MERGEFIELD Office}=3 "Fresno" {IF{MERGEFIELD Office}=4 "Tucson"} I see that there are more left wavy brackets than right ones, and that I haven't concluded the equation (what if not 1, 2, 3, or 4), but I don't understand. Could someone help or direct me to a good rudimentary explanation? TIA "Greg Maxey" wrote in message ... You want the City in CAPs correct? Try {Mergefield City \* UPPER } -- Greg Maxey/Word MVP A Peer in Peer to Peer Support zSplash wrote: How do I code multi-else's using mail merge? Example: I want whatever is City to be Ucase, but evidently I can't use VBA code in mail merges, so I can figure out how to make Seattle capitalized if City = Seattle, but how do I add other cities? I have tried, but only get City instead of TUCSON: {IF {MERGEFIELD City}= Seattle "SEATTLE" {IF{MERGEFIELD City} = Tucson "TUCSON"} ""} If City one of my "defined" cities, can I just merge, and let the field stop and let the user manually type in (capitalized) City? I hope my question is clear. TIA. |
#9
|
|||
|
|||
Thank you so much, Greg. Your help has been outstanding (and worked)!
st. "Greg Maxey" wrote in message ... zSplash, Not tested, but try something like: { IF { NUM1 }""{ NUM1 }{ IF{ NUM2 }""{ NUM2 }{ NUM3}}} -- Greg Maxey/Word MVP A Peer in Peer to Peer Support zSplash wrote: Thanks, Greg. Your earlier example was fine. So, now I wonder, can I compare 3 fields from the data source and based on the comparison, "get" one of the fields? (That is, consider 3 unique fields: num3, num2, num1. If num3 is empty, check num2; if num2 is empty, "get" num1.) Do I use "IF THEN" or something else? It's just a little sad trying to "get the syntax (i.e., the demanded # of curly braces, etc.)" for the mail merge Word fields when things are so straight-forward in VBA. TIA "Greg Maxey" wrote in message ... zSpash, Sorry for the clipped reply earlier. My wife was assigning me a chore :-) You can nest the additional conditions as I showed you in my last post (replace Test with your mergefield name) or in this case you can simply gang them together {IF{TEST}="1""SEATTLE"}{IF{TEST}="2""PORTLAND"} etc. -- Greg Maxey/Word MVP A Peer in Peer to Peer Support zSplash wrote: But, can I have multi-elses? I tried, and got error: Unknown op code for conditional: {IF{MERGEFIELD Office}=1 "Seattle" {IF{MERGEFIELD Office}=2 "Portland" {IF{MERGEFIELD Office}=3 "Fresno" {IF{MERGEFIELD Office}=4 "Tucson"} I see that there are more left wavy brackets than right ones, and that I haven't concluded the equation (what if not 1, 2, 3, or 4), but I don't understand. Could someone help or direct me to a good rudimentary explanation? TIA "Greg Maxey" wrote in message ... You want the City in CAPs correct? Try {Mergefield City \* UPPER } -- Greg Maxey/Word MVP A Peer in Peer to Peer Support zSplash wrote: How do I code multi-else's using mail merge? Example: I want whatever is City to be Ucase, but evidently I can't use VBA code in mail merges, so I can figure out how to make Seattle capitalized if City = Seattle, but how do I add other cities? I have tried, but only get City instead of TUCSON: {IF {MERGEFIELD City}= Seattle "SEATTLE" {IF{MERGEFIELD City} = Tucson "TUCSON"} ""} If City one of my "defined" cities, can I just merge, and let the field stop and let the user manually type in (capitalized) City? I hope my question is clear. TIA. |
#10
|
|||
|
|||
You can use VBA in merges if you are using Word 2002/2003 by using the
Mailmerge events, which give you the opportunity to modify the mail merge main document before each record is merged, and so on. For example, suppose your Mail merge Main document has adocvariable field called { DOCVARIABLE myvalue } then you can do all your if..then..else stuff in VBA in the appropriate event handler and simply set the document variable "myvalue" to the result you want. Peter Jamieson "zSplash" zNOSPAMSplash@ gci.net wrote in message ... How do I code multi-else's using mail merge? Example: I want whatever is City to be Ucase, but evidently I can't use VBA code in mail merges, so I can figure out how to make Seattle capitalized if City = Seattle, but how do I add other cities? I have tried, but only get City instead of TUCSON: {IF {MERGEFIELD City}= Seattle "SEATTLE" {IF{MERGEFIELD City} = Tucson "TUCSON"} ""} If City one of my "defined" cities, can I just merge, and let the field stop and let the user manually type in (capitalized) City? I hope my question is clear. TIA. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I write IF statements in Mail Merge | Mailmerge | |||
IF statements always returning the "False" condition | Mailmerge | |||
MERGE: Can I have multiple SET statements based on one IF | Mailmerge | |||
financial statements | Microsoft Word Help | |||
Using Hyperlinks in Mail Merge IF...THEN...ELSE Statements | Mailmerge |