Mail merge to members of a contact group

Last reviewed on May 29, 2014

Another day, another Lazy Programmer macro. This one is tweaked (or chopped) from Add a Category to Contacts in a Contact Group, only instead of looking up a contact and adding a category to it, I create a new message to the address. Yes, I could have done this without using that macro, but I wouldn't be a lazy programmer if I wrote macros from scratch.

To mail merge to contact groups (i.e. send the same email message to 20 groups, 1 message per group) see Mail Merge to Contact Gropups

While this macro is not all that practical as currently written, you could use a template or UserForm to add the subject and message body. Heck, you could even use clipboard contents for the message body.

Note: As written, this macro opens a new message on screen, one for each member of the Contact group. Test it with a small Contact group (DL)!

Don't forget to get the GetCurrentItem function from Work with open item or selected item

Sub Merge_to_Group()
Dim o_list As Object

Dim objMsg As MailItem

' select or open the distribution list
' you need the GetCurrentItem function from 
' http://slipstick.me/e8mio
Set o_list = GetCurrentItem()

For i = 1 To o_list.MemberCount

Set objMsg = Application.CreateItem(olMailItem)
With objMsg
  .To = o_list.GetMember(i).Address
  .Subject = "Test Subject"
  .Body = "Message Text"

' use .display for testing
' .send to send the messages automatically
  .Display 
End With
Set objMsg = Nothing
     
Next
End Sub

Written by

Diane Poremsky
A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Please post long or more complicated questions at Outlookforums.

Leave a Reply

If the Post Coment button disappears, press your Tab key.