0
votes

I have got an excel sheet with many email ids (duplicates also).Need a macro which can pick distinct email ids from the list and send email to all of them in a single mail.Also the mail subject must contain date e.g Release X report dated DD-MMM.Mail body should copy a range of cells from the same excel sheet.Can someone please help me with the macro.

1

1 Answers

0
votes

Provided you have the outlook client installed - take a look at this http://www.rondebruin.nl/win/s1/outlook/bmail2.htm. It looks like a nearly right out of the box answer, even though you still need to get into it a little bit and adjust mail parameters to your case

This code basically involves 2 main parts:
- the main Mail_Selection_Range_Outlook_Body procedure, which sets an instance of the outlook application, creates an email, populates parameters (to, cc, subject, body...) and sends the email
- the RangetoHTML utility function called by the main procedure, which publishes the excel data range to be sent to HTML. The result is assigned to the mail item HTMLBody - not Body - property in the main procedure for proper rendering

You should select your source data range before running the main procedure.

For test purposes, you may find it helpfull to replace the ".send" mail item property with ".display" in a first place - this will result in the main sub displaying the ready to be sent mail on screen rather than actually just sending it.