mail merging contacts and contact groups. can code achieve this?

Status
Not open for further replies.

mr_malkovich

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Hey all. Got Outlook 2013/O365 on Windows 7.

I use Mail Merge all day, everyday. I also have plenty of contact groups. I would love to figure out a way to get Mail Merge to merge contacts AND contact groups in one merge, so that invididual contacts would continue to receive individual emails as usual, but the members of each selected contact group would receive group emails.

Is this remotely possible or am I wishing on a star here?
 

mr_malkovich

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Hey there, thanks for this. This looks good except I also use a macro to insert each contact's name into the respective recipient's email title. How can I achieve this while using the contact group mail merge macro?
 

mr_malkovich

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
So I would insert the line of code you just suggested into this macro here from the slipstick article you posted above? Where in the code would I put your new line?

Sub MailMergeDL()
Dim objApp As Outlook.Application
Dim objItem As Outlook.MailItem
Dim objMsg As Outlook.MailItem
Dim objOutlookRecip As Recipient
Dim Recipients As Recipients

Dim i As Integer

Set objApp = Application
Set objItem = objApp.ActiveInspector.CurrentItem

If objItem.Recipients.Count > 0 Then
For i = 1 To objItem.Recipients.Count Set objMsg = objApp.CreateItem(olMailItem)
With objMsg
.HTMLBody = objItem.HTMLBody
.Subject = objItem.Subject
.Recipients.Add objItem.Recipients(i)
End With
For Each objOutlookRecip In objMsg.Recipients
objOutlookRecip.Resolve
Next
objMsg.Display
Next i
End If
' close the merge template without saving
objItem.Close olDiscard 'use olSave to save a draft

Set objItem = Nothing
Set objApp = Nothing

End Sub
 

mr_malkovich

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
And do you think it's somehow possible to just select individual contacts as well as contact groups as part of one routine mail merge, then create an email mail merge in a way that individual contacts would continue to receive individual emails as usual, but the members of each selected contact group would receive group emails? And each email title containing the first name of each recipient? The solution outlined in http://www.slipstick.com/developer/send-mail-merge-contact-groups/ will definitely suffice, but doing these kinds of combo contact/contact group mail merges would be a dream come true.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
No, unfortunately you cant use a contact group/dl as a record in a mail merge. You need to use individual contacts.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I'm on my tablet so I can't test it and I'm not 100% sure. Did you try it as is?
 

mr_malkovich

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Finally got a chance to test the macro in http://www.slipstick.com/developer/send-mail-merge-contact-groups/. It works for the most part, except:

1. It creates the emails but I have to hit Send on each. Is there a way to just have them sent directly to the outbox?
2. My signature icons don't make it into the emails. (see pic)
3. Occasionally it will remove the emails associated with the name. For instance, in the pic you'll see that 1146 Miles is a contact group but once the macro creates the email, '1146 Miles' is just text, not a contact group. I have to manually re-add the contact group 1146 Miles to that email to have it sent successfully.

Finally, how would I adjust the macro code so that the FullName field of each contact group appears in each email title where I'd type <Full_Name> so we can personalize these babies?

Exciting...!
 

Attachments

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
This line: objMsg.Display is set for testing. change display to send when you wan to send it.

If the group is in contacts, outlook *should* resolve it on send. It's actually supposed to resolve it in the code -
For Each objOutlookRecip In objMsg.Recipients
objOutlookRecip.Resolve
Next

I think you can use objItem.GetMember(i).Name to get the DL name. But the merge doesn't support DLs, so you'd need to use bookmarks and VBA to send the name to the body.

I'm not sure on the images - they should work though. I'll have to test it.
 

mr_malkovich

Senior Member
Outlook version
Outlook 2007
Email Account
Exchange Server
See the attached pic for the error code I receive when I change objMsg.Display to objMsg.Send.

Where in this code do I insert objItem.GetMember(i).Name in order to have the DL's fullname inserted in each email title? I don't need to send the name to the body, just the email titles.
 

Attachments

Status
Not open for further replies.
Top