Macro & VBscript

G

Gwen Powell

I want to write a macro/script for my Word mail merge. My data source has
two phone fields. I never know which field has data. I want the merge to
use only the first field that has data. I know how to do this is MSAccess
but have never programmed Word. Can someone please point me to a tutorial
and/or code to accomplish this.

I am using Word 2002 and 2003 on Windows XP. I do not have VBScript or
VBScript run time.

Thanks,
Gwen Powell
 
J

Jean-Guy Marcil

Gwen Powell was telling us:
Gwen Powell nous racontait que :
I want to write a macro/script for my Word mail merge. My data
source has two phone fields. I never know which field has data. I
want the merge to use only the first field that has data. I know how
to do this is MSAccess but have never programmed Word. Can someone
please point me to a tutorial and/or code to accomplish this.

I am using Word 2002 and 2003 on Windows XP. I do not have VBScript
or VBScript run time.

You do not need a macro for this.
Use an IF field:

{IF {MERGEFIELD Phone1}= "" "{MERGEFIELD Phone2}" "{MERGEFIELD Phone1}"}

where the {} are entered via CTRL-F9 or Insert > Fields...

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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