A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How display values of {SET foo} variables?



 
 
Thread Tools Display Modes
  #1  
Old February 21st, 2010, 11:24 PM posted to microsoft.public.word.mailmerge.fields
FUBARinSFO[_2_]
external usenet poster
 
Posts: 18
Default How display values of {SET foo} variables?

Hi:

In working through the logic of a many-to-one directory mail merge,
I've created some variable with the {SET var} expression:

[SET foo {MERGEFIELD F1}}
{SET bar {MERGEFIELD F2}}

and I'm testing them, as with

{IF foo bar "true" "false"}

But I haven't been able to figure out how to display the actual
current values of 'foo' and 'bar' in the document so I can debug the
logic.

I've tried:
foo= {foo}
bar= {bar}

but it doesn't do it.

Thanks in advance.

-- Roy Zider
  #2  
Old February 21st, 2010, 11:44 PM posted to microsoft.public.word.mailmerge.fields
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default How display values of {SET foo} variables?

Hi Roy,

Try:
{foo} and {bar}
or:
{REF foo} and {REF bar}

More generally, for a many-to-one directory mail merge, check out my Word 97-2007 Catalogue/Directory Mailmerge Tutorial at:
http://lounge.windowssecrets.com/ind...owtopic=731107
or
http://www.gmayor.com/Zips/Catalogue%20Mailmerge.zip
Do read the tutorial before trying to use the mailmerge document included with it.


--
Cheers
macropod
[Microsoft MVP - Word]


"FUBARinSFO" wrote in message ...
Hi:

In working through the logic of a many-to-one directory mail merge,
I've created some variable with the {SET var} expression:

[SET foo {MERGEFIELD F1}}
{SET bar {MERGEFIELD F2}}

and I'm testing them, as with

{IF foo bar "true" "false"}

But I haven't been able to figure out how to display the actual
current values of 'foo' and 'bar' in the document so I can debug the
logic.

I've tried:
foo= {foo}
bar= {bar}

but it doesn't do it.

Thanks in advance.

-- Roy Zider

  #3  
Old February 21st, 2010, 11:50 PM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default How display values of {SET foo} variables?

{ foo }
and
{ REF foo }
should work, but only if the { } are the special field braces you can
insert using ctrl-F9

But for this type of application you could usefully look at the
following two references:
a. Doug Robbins' stuff at

http://www.gmayor.com/ManyToOne.htm

a. macropod's tutorial - I quote:

-------------------
You can use Word's Catalogue/Directory Mailmerge facility for this (the
terminology depends on the Word version). To see how, check out my Word
97-2007 Catalogue/Directory Mailmerge Tutorial at:
http://lounge.windowssecrets.com/ind...owtopic=731107
or
http://www.gmayor.com/Zips/Catalogue%20Mailmerge.zip
Do read the tutorial before trying to use the mailmerge document
included with it.
-------------------

Beware of odd behaviour of comparands in IF statements - e.g. if a SET
variable contains a text such as 123-45, Word may actually see it as a
calculation. Also, if the value of { MERGEFIELD F1 } is set to "bar",
i.e. you set foo to bar, you may find that Word actually uses the value
of the bar SET variable when you specify foo. Sometimes it may make
sense to use syntax that can avoid those problems, such as

{ IF "{ REF foo }" "{ REF bar }" "true" "false" }

Peter Jamieson

http://tips.pjmsn.me.uk

On 21/02/2010 23:24, FUBARinSFO wrote:
Hi:

In working through the logic of a many-to-one directory mail merge,
I've created some variable with the {SETvar} expression:

[SET foo {MERGEFIELD F1}}
{SET bar {MERGEFIELD F2}}

and I'm testing them, as with

{IF foo bar "true" "false"}

But I haven't been able to figure out how to display the actual
current values of 'foo' and 'bar' in the document so I can debug the
logic.

I've tried:
foo= {foo}
bar= {bar}

but it doesn't do it.

Thanks in advance.

-- Roy Zider

  #4  
Old February 22nd, 2010, 12:13 AM posted to microsoft.public.word.mailmerge.fields
FUBARinSFO[_2_]
external usenet poster
 
Posts: 18
Default How display values of {SET foo} variables?

For some reason, neither of the statements are displaying the value on
merge:

{SET VAR1 = "foo"}
{SET VAR2 = "bar"}

Var1: {var1}
Var2: {REF var2}

In contrast, I do know how to display stuff. This works OK:

Mergeseq variable: {MERGESEQ}
Mergerec variable: {MERGEREC \* MERGEFORMAT}

Yes, the above braces are Ctrl-F9 braces. And I have referenced the
links to the excellent tutorials and code. What I am doing is working
some of this out for myself, and find I can't even get this little
thing straight.

-- Roy
  #5  
Old February 22nd, 2010, 12:41 AM posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default How display values of {SET foo} variables?

You should not include the "=" sign and have you updated the fields. The
bookmarks are not created until the { SET } field has been updated.

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.

"FUBARinSFO" wrote in message
...
For some reason, neither of the statements are displaying the value on
merge:

{SET VAR1 = "foo"}
{SET VAR2 = "bar"}

Var1: {var1}
Var2: {REF var2}

In contrast, I do know how to display stuff. This works OK:

Mergeseq variable: {MERGESEQ}
Mergerec variable: {MERGEREC \* MERGEFORMAT}

Yes, the above braces are Ctrl-F9 braces. And I have referenced the
links to the excellent tutorials and code. What I am doing is working
some of this out for myself, and find I can't even get this little
thing straight.

-- Roy


  #6  
Old February 22nd, 2010, 12:46 AM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default How display values of {SET foo} variables?

If you are actually doing
{ SET VAR1 = "foo" }

then VAR1 will actually be set to "=" (in which case you might not be
noticing the output :-) )

{ SET VAR1 "foo" }
would do it, or

{ SET VAR1 foo }

if there are no spaces in the text.

But assuming that is not the problem, are you actually seeing

Var1:
Var2:

in the output? If not, my best guess is that you might have nested those
lines in another field in such a way that they would never output. If
you are seeing them, could it be that the SET fields have not executed
because they are nested inside an IF, or some such?

Peter Jamieson

http://tips.pjmsn.me.uk

On 22/02/2010 00:13, FUBARinSFO wrote:
For some reason, neither of the statements are displaying the value on
merge:

{SET VAR1 = "foo"}
{SET VAR2 = "bar"}

Var1: {var1}
Var2: {REF var2}

In contrast, I do know how to display stuff. This works OK:

Mergeseq variable: {MERGESEQ}
Mergerec variable: {MERGEREC \* MERGEFORMAT}

Yes, the above braces are Ctrl-F9 braces. And I have referenced the
links to the excellent tutorials and code. What I am doing is working
some of this out for myself, and find I can't even get this little
thing straight.

-- Roy

  #7  
Old February 22nd, 2010, 01:33 AM posted to microsoft.public.word.mailmerge.fields
FUBARinSFO[_2_]
external usenet poster
 
Posts: 18
Default How display values of {SET foo} variables?

Doug and Peter:

Programming is humbling:
.................................................. ....................
You should not include the "=" sign
then VAR1 will actually be set to "=" (in which case you might not be
noticing the output :-) )

You should not include the "=" sign
then VAR1 will actually be set to "=" (in which case you might not be
noticing the output :-) )

You should not include the "=" sign
then VAR1 will actually be set to "=" (in which case you might not be
noticing the output :-) )

You should not include the "=" sign
then VAR1 will actually be set to "=" (in which case you might not be
noticing the output :-) )

You should not include the "=" sign
then VAR1 will actually be set to "=" (in which case you might not be
noticing the output :-) )

You should not include the "=" sign
then VAR1 will actually be set to "=" (in which case you might not be
noticing the output :-) )

You should not include the "=" sign
then VAR1 will actually be set to "=" (in which case you might not be
noticing the output :-) )

You should not include the "=" sign
then VAR1 will actually be set to "=" (in which case you might not be
noticing the output :-) )

You should not include the "=" sign
then VAR1 will actually be set to "=" (in which case you might not be
noticing the output :-) )

You should not include the "=" sign
then VAR1 will actually be set to "=" (in which case you might not be
noticing the output :-) )
.................................................. ....................................

Uhh, OK. I think I got it now. Duhhh.

Thank you so much. Maybe I can even remember this.

-- Roy
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:46 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.