need help with a macro

M

mehherc

Ok, I cannot seem to figure this out or at least get it to work right. What I
am doing is trying to bring a list customers from an excel sheet and have
their lastname print on it with the proper salutation for them in a Word
document. In the excel sheet, the columns are labeled as lastname then
firstname then sex. When I use the mailmerge option, i get either the sex
and lastname(F Martinez) or firstname lastname (Emilia Martinez). I want it
to show Ms. Martinez.. I cannot do a substitutionon the Excel sheet. If I
could, the problem would have been solved along time ago. I am a little
frustrated by it. I have been working on it for 2 days now. I need the Word
document to read " Dear Ms. Martinez,".

Sorry for the whining. I am just aggravated at it now.
 
D

Doug Robbins - Word MVP

Use an If...then...Else... field

{ IF { MERGEFIELD sex } = "F" "Ms." Mr." }

The easiest way for you to do this is to insert that field for the Word
Fields pulldown. If you enter it directly from the keyboard, use Ctrl+F9 to
insert each pair of field delimiters { }


--
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
 
M

mehherc via OfficeKB.com

Ok, I must be showing my Blond, When I enter in IF { MERGEFIELD sex } = "F"
"Ms." Mr." , the text in word shows "MERGEFIELD". It might be working right,
but how do I tell WORD to go to that particular XLS sheet to match the "sex"
field?
 
M

mehherc via OfficeKB.com

OK, never mind about how it gets the info from the excel sheet I figured that
out. But it still shows MERGEFIELD in the text, How do I change that so it
displays the Mr. or Ms.?
 
D

Doug Robbins - Word MVP

I think that you must have omitted to read pr follow the last paragraph of
my post.

--
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
 
C

Charles Kenyon

Download the gender toolbar from my website. You can use the fields in it to
build the merge fields you need. http://addbalance.com/word/download.htm

Simply replace the { DocVariable Gender } fields with your test mergefields.
My fields test for "male" and "female".
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 

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