Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
MacroButton
Hi,
we use a software package that merges the data with Word documents thru macrobuttons. When setting an address for a letter this looks like {MacroButton CompanyXValue "Name Relation"} {MacroButton CompanyXValue "Attn. line"} {MacroButton CompanyXValue "Address Line"} {MacroButton CompanyXValue "Place Line"} this all works fine. Sometimes however is the "Name Relation" the same as "Attn. line" and then i want to exclude the "Attn. Line" I thought to do this by the following code : {if "{MacroButton CompanyXValue "Name Relation"}" "{MacroButton CompanyXValue "Attn. Line"}" "{MacroButton CompanyXValue "Attn. Line"}" "" } When i make such a structure with MergFields, then it works. This construction with MacroButton doesn't work. Can anybody tell me why this doesn't work or how i can get i to work ? thanks Keam |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
MacroButton
Can anybody tell me why this doesn't work
It probably does not work because a. when the user clicks a macrobutton, typically the macro replaces the button by some text or graphics. In other words, it does not set the result of the MACROBUTTON field to the text/graphics b. in any case, the MACROBUTTONs within the IF field are completely different MACROBUTTONs that the user cannot click (they cannot see them), so even if you are changing the "results" of the Macrobuttons that the user clicks, you are not setting the results of the MACROBUTTON fields inside the IF c. in any case, if you do { IF "{ MACROBUTTON mysub a }" = "{ MACROBUTTON mysub b }" "same" "different" } if you toggle the individual fields so that you can see the result of the MACROBUTTONs within the IF field what you see is { IF "a " = "b " "same" "different" } Normally, that would result in "Different", but in this case it results in "same", which is presumably a result of something weird about Macrobutton fields. or how i can get i to work ? I think it will be difficult because, as I said above, the macrobutton relies on the user being able to see the buttons and click them, so you cannot hide them within an IF. But if they are outside the IF, the results are displayed and there is nothing you can do about the duplicated line (because you need an IF to do that). You cannot for example cover the Macrobuttons with bookmarks and compare them using IF, because the results of the macrobutton clicks are already in the document. It might be possible to change the code of the macro "CompanyXValue" so that it detects this situation and removes the second line when they are equal but a. that could be difficult b. you probably do not have access to the macrobutton code Another possibility would be to write your own Macrobutton macro that generated the entire address in the format you need (i.e. doing all the necessary comparison work internally) and allowed you to place just one Macrobutton field in the document. I do not know if that is feasible in the environment you are working in. Peter Jamieson "Kees van Amerongen" wrote in message ... Hi, we use a software package that merges the data with Word documents thru macrobuttons. When setting an address for a letter this looks like {MacroButton CompanyXValue "Name Relation"} {MacroButton CompanyXValue "Attn. line"} {MacroButton CompanyXValue "Address Line"} {MacroButton CompanyXValue "Place Line"} this all works fine. Sometimes however is the "Name Relation" the same as "Attn. line" and then i want to exclude the "Attn. Line" I thought to do this by the following code : {if "{MacroButton CompanyXValue "Name Relation"}" "{MacroButton CompanyXValue "Attn. Line"}" "{MacroButton CompanyXValue "Attn. Line"}" "" } When i make such a structure with MergFields, then it works. This construction with MacroButton doesn't work. Can anybody tell me why this doesn't work or how i can get i to work ? thanks Keam |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
MacroButton
Thanks for your reaction. The last suggestion is the one i will dive into .
thnks "Peter Jamieson" schreef in bericht ... Can anybody tell me why this doesn't work It probably does not work because a. when the user clicks a macrobutton, typically the macro replaces the button by some text or graphics. In other words, it does not set the result of the MACROBUTTON field to the text/graphics b. in any case, the MACROBUTTONs within the IF field are completely different MACROBUTTONs that the user cannot click (they cannot see them), so even if you are changing the "results" of the Macrobuttons that the user clicks, you are not setting the results of the MACROBUTTON fields inside the IF c. in any case, if you do { IF "{ MACROBUTTON mysub a }" = "{ MACROBUTTON mysub b }" "same" "different" } if you toggle the individual fields so that you can see the result of the MACROBUTTONs within the IF field what you see is { IF "a " = "b " "same" "different" } Normally, that would result in "Different", but in this case it results in "same", which is presumably a result of something weird about Macrobutton fields. or how i can get i to work ? I think it will be difficult because, as I said above, the macrobutton relies on the user being able to see the buttons and click them, so you cannot hide them within an IF. But if they are outside the IF, the results are displayed and there is nothing you can do about the duplicated line (because you need an IF to do that). You cannot for example cover the Macrobuttons with bookmarks and compare them using IF, because the results of the macrobutton clicks are already in the document. It might be possible to change the code of the macro "CompanyXValue" so that it detects this situation and removes the second line when they are equal but a. that could be difficult b. you probably do not have access to the macrobutton code Another possibility would be to write your own Macrobutton macro that generated the entire address in the format you need (i.e. doing all the necessary comparison work internally) and allowed you to place just one Macrobutton field in the document. I do not know if that is feasible in the environment you are working in. Peter Jamieson "Kees van Amerongen" wrote in message ... Hi, we use a software package that merges the data with Word documents thru macrobuttons. When setting an address for a letter this looks like {MacroButton CompanyXValue "Name Relation"} {MacroButton CompanyXValue "Attn. line"} {MacroButton CompanyXValue "Address Line"} {MacroButton CompanyXValue "Place Line"} this all works fine. Sometimes however is the "Name Relation" the same as "Attn. line" and then i want to exclude the "Attn. Line" I thought to do this by the following code : {if "{MacroButton CompanyXValue "Name Relation"}" "{MacroButton CompanyXValue "Attn. Line"}" "{MacroButton CompanyXValue "Attn. Line"}" "" } When i make such a structure with MergFields, then it works. This construction with MacroButton doesn't work. Can anybody tell me why this doesn't work or how i can get i to work ? thanks Keam |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macrobutton word 2003 | Microsoft Word Help | |||
How to get MacroButton not to print if nothing is typed in it | Microsoft Word Help | |||
MACROBUTTON macro dropdown list | Microsoft Word Help | |||
How to keep date issued (not created) on protected form? | Microsoft Word Help | |||
Using MacroButton fields as a text marker | Microsoft Word Help |