Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to a send a bunch on emails from Outlook that reads from Word and Excel. The text content will be from Word and user_email_ID, First_Name content will be from Excel. I know how to do up to this part and have done so in the past but a new addition will be to merge some fields only based on yes/no (Y/N) from the Excel sheet. For example:

  Name Age Field1 Field2 Field3
  XXX   39   Y       N     Y
  YYY   29   N       N     N
  ZZZ   10   Y       Y     Y

In the above case, the text should look like:

for Record 1

Hello <Name>
       text text text, items 
       1) Field 1
       2) Field 3

for Record 2

Hello <Name>
       text text text, items 

       No Items, you are good to go.

for Record 3

Hello <Name>
       text text text, items 
       1) Field 1
       2) Field 2
       3) Field 3

This part should not take me much time to do in C++, or even is MySQL but I am not so quick using Microsoft products like Excel, Word, Outlook.

Can someone be kind enough to give me a heads up on which one should I start looking for in Outlook or Excel, or redirection to a relevant article please? Also, has anyone had the same problem before?

share|improve this question

migrated from Apr 11 '12 at 15:08

This question came from our site for professional and enthusiast programmers.

Just Office merge, How can I migrate this topic to superuser? – howtechstuffworks Apr 10 '12 at 18:21
I'll get a moderator to do that for you, just sit tight. – Alain Apr 10 '12 at 18:24
^ Done, Thanks Alain.... – howtechstuffworks Apr 10 '12 at 18:27
Is Someone experiencing the same problem?? – howtechstuffworks Apr 16 '12 at 19:25

You have to add the braces with Ctrl-F9 but you basically want the simple IF. {IF {MERGEFIELD My_Field} = "Y" "some text" ""}.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .