#1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Kees van Amerongen Kees van Amerongen is offline
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Kees van Amerongen Kees van Amerongen is offline
external usenet poster
 
Posts: 2
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
macrobutton word 2003 john mcmichael Microsoft Word Help 3 June 9th 06 09:19 PM
How to get MacroButton not to print if nothing is typed in it mj Microsoft Word Help 1 October 18th 05 06:44 PM
MACROBUTTON macro dropdown list Leonard Microsoft Word Help 2 September 2nd 05 05:21 PM
How to keep date issued (not created) on protected form? Seagull Microsoft Word Help 2 June 24th 05 09:57 PM
Using MacroButton fields as a text marker Elle Microsoft Word Help 2 May 5th 05 10:21 PM


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