View Single Post
  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default User Merge Field

Peter was the omission of the closing quote after "Gert or "GERT an
oversight or a bit of shorthand?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Peter Jamieson" wrote in message
...
If you have the username field set to say "Gert Raes" and you use

{ IF { USERNAME } = "Gert Raes" "match" "no match" }

you should see "match.

If you have the username field set to "Gert" and you have

{ IF { USERNAME } = "Gert "match" "no match" }

then you should see "match", unless you also have a bookmark called "Gert"
that is set to something other than "Gert". In that case you might see "no
match". In that case, to ensure (in almost every case) that you see
"match, put quotes around the USERNAME field

{ IF "{ USERNAME }" = "Gert "match" "no match" }

The user name needs to match whatever you are comparing it with /exactly/,
otherwise you will get "no match". e.g. if capitalisation can vary, use

{ IF "{ USERNAME \*Upper } = "GERT "match" "no match" }

If none of that explains what you see, please spell out what your fields
actually contain.

Peter Jamieson


"Gert Raes" wrote in message
...
In addition to this post, the next question :

I use the wordfield "username" in a document.
When I use that field in an If-Then-Else Statement, the result is always
the
not true - value.

Anyone an idea ?

"Peter Jamieson" wrote:

One possibility is to use a { USERNAME } field, which inserts the name
of
the user as specified in the User info. for /Word/.

If you really need the "user name" that is set up in the user's
environment
(i.e. the one that is displayed if you use a SET command in aDOS/CMD
box),
there is no built-in /Word/ field that can do it, and whether or not you
can
get the value as a /merge/ field depends on what your data source is -
e.g.,
you /might/ be able to get it from an Access database by using an
environ('username') function call in an Access query, but even that
depends
on whether or not Access is operating in "sandbox mode", which is to do
with
security.

You could also probably use a bit of Word VBA (and the
Environ("username")
function call) to insert the required value, oryou might be able to use
a
Word Auto macro to set up the value of a Word document variable or
property
that you could insert using a { DOCVARIABLE } or { DOCPROPERTY } field.

So it's not straightforward, but maybe that will give you some options
with
which you can experiment.

Peter Jamieson

"Jo Davis" wrote in message
...
Hi

I am trying to create a merge document, i want to insert a merge field
of
the user that is logged onto the computer and using the merge document
at
that time, can this be done???

Jo