Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / September 2004

Tip: Looking for answers? Try searching our database.

Compound IF in merge field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jim R - 15 Sep 2004 18:24 GMT
I have been merging Excel to Word2K without a problem.  Now what I
want to do is the following:

If PropertyVacant = 1 then "Vacant"
  elseif PropertyRented = 1 then "Rented"
  else
     "Owner Occupied"
endif

The fields PropertyVacant and PeopertyRented are on the merged Excel
file.  I want to put the literals on the Word document.

I know I can use VBA but I'm not sure exactly how and were to put it
in VBA.

Any help would be appreciated.
Greg - 15 Sep 2004 19:36 GMT
Jim,

You can do this with fields in the merge document without
using VBA:

{IF{MergeField PropertyVacant} = "1""Vacant"{IF{MergeField
PropertyRented} = "1""Rented""Owner Occupied"}}

>-----Original Message-----
>I have been merging Excel to Word2K without a problem.  Now what I
[quoted text clipped - 14 lines]
>Any help would be appreciated.
>.
Graham Mayor - 16 Sep 2004 10:31 GMT
While fields do not require speech mark delimiters, as Greg has shown here,
it makes the construction simpler to follow if they are used
ie
{IF{MergeField fieldname} = "condition" "do this" "otherwise do this"}
Either result can consist of further conditions thus:

{IF{MergeField PropertyVacant} = "1" "Vacant" "{IF{MergeField
PropertyRented} = "1" "Rented" "Owner Occupied"}"}

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Jim,
>
[quoted text clipped - 24 lines]
>> Any help would be appreciated.
>> .
Jim R - 17 Sep 2004 15:02 GMT
I appreciate all the help but it doesn't seem to be working  I did a
cut and past and when I do the merge I get PropertyVacant} in the
merged field which is what is shown there before the merge if the
switches aren't showing.

I don't know if this makes a difference or not but the fields being
compared are numeric 0 or 1 but I tried the compares with and without
quotes and the results are the same.

I really would rather not do it with VBA but if I have to I will.  

Thanks again for the attempt.

Jim
> While fields do not require speech mark delimiters, as Greg has shown here,
> it makes the construction simpler to follow if they are used
[quoted text clipped - 33 lines]
> >> Any help would be appreciated.
> >> .
Graham Mayor - 17 Sep 2004 15:26 GMT
You can't use cut and paste! The field delimiters {} are not typed from the
keyboard, but set with CTRL+F9.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> I appreciate all the help but it doesn't seem to be working  I did a
> cut and past and when I do the merge I get PropertyVacant} in the
[quoted text clipped - 58 lines]
>>>> Any help would be appreciated.
>>>> .
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.