MacroButton

  • Thread starter Kees van Amerongen
  • Start date
K

Kees van Amerongen

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
 
P

Peter Jamieson

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
 
K

Kees van Amerongen

Thanks for your reaction. The last suggestion is the one i will dive into .

thnks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top