Last reviewed on May 29, 2014   —  No Comments

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


Leave a Reply

Please post long or more complicated questions at OutlookForums by Slipstick.com.

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