VBA script to allow mail merges of distribution groups?

Status
Not open for further replies.

mr_malkovich

Senior Member
Outlook version
Email Account
Exchange Server
Hey all. Is there a code that will allow me to mail merge distribution groups? So for instance if I mail merged 20 distribution groups, I'd end up with 20 emails in my outbox, and each would be going to the email addresses assigned to their groups?

Thanks as always..
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
i don't have any code that does that but i have code that will mail merge to members of a DL - one address per message.

http://www.slipstick.com/developer/mail-merge-members-contact-group/ has normal mail merge behavior of individual messages but uses the members of a contact group (dl) as the source.

Outlook can resolve the group names, so I'd make a text list of the group names and use it as the address source. You need to make sure the names are unique so outlook doesn't resolve them to the wrong person or group.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Well, my initial thought when you first asked was no, but upon further reflection, I think so. I think you'd want to use an outlook form, not a traditional mail merge in word, and copy it using VBA as you send it to each group. Deciding how to pick up the group names would be the hardest part - do you select them in contacts and run the macro, add them to the message you are using as the merge message then break the recipients list up for each message, pick from a list...
 

mr_malkovich

Senior Member
Outlook version
Email Account
Exchange Server
I like to think I'm good with Outlook, but I understood about 3% of that. When you say use an Outlook form, do you mean a contact form?
Could some kind of app be designed to make this a smooth process? Every day I email a couple of hundred people using mail merge. Some of them need to receive the email individually, and others need to receive it along with a couple other members of their organization. Currently I stop them all in the outbox and go in and manually delete all but one of the emails that are headed to individual members of one company, then manually add their email addresses to the To section of the remaining email then send them all off when I've gone through the whole outbox. Painful.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Sorry about that, I meant outlook mail message. Create the message, add all DLs to the To field then run the macro to copy the message and send it to each group individually.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
To use, create a message, enter the Contact groups (or contacts) in the To field then run the macro. Close the original message. put it in thisoutlooksession and add a button to the qat.

http://www.slipstick.com/developer/how-to-use-outlooks-vba-editor/

Code:
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 ' use Send to send automatically
   Next i 
 
End If 
' close the merge message without saving 
objItem.Close olDiscard 'use olSave to save it as a draft 
 
Set objItem = Nothing 
Set objApp = Nothing 
 
End Sub
 

mr_malkovich

Senior Member
Outlook version
Email Account
Exchange Server
Wow. Interesting. Going to carve some time to get to grips with this and get back to you. Thanks as always, Diane.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
J Outlook Rules VBA Run a Script - Multiple Rules Outlook VBA and Custom Forms 0
FryW Need help modifying a VBA script for in coming emails to auto set custom reminder time Outlook VBA and Custom Forms 0
A VBA Script - Print Date between first email in Category X and last email in Category Y Outlook VBA and Custom Forms 3
L Modifying VBA script to delay running macro Outlook VBA and Custom Forms 3
L Need help modifying a VBA script for emails stuck in Outbox Outlook VBA and Custom Forms 6
D.Moore VBA script fail after Office 365 update Using Outlook 8
S Change VBA script to send HTML email instead of text Outlook VBA and Custom Forms 3
dweller Outlook 2010 Rule Ignores VBA Script Outlook VBA and Custom Forms 2
N VBA Script to Open highlighted e-mail and Edit Message Outlook VBA and Custom Forms 5
K Outlook Archive to PST Files by Date Range VBA Script? Outlook VBA and Custom Forms 1
Peter H Williams Enable script containing VBA Outlook VBA and Custom Forms 12
R VBA Script Quick Parts Using Outlook 1
Q VBA Script to move item in secondary mailbox Outlook VBA and Custom Forms 2
N VBA Script to Send Automatic Emails from Outlook 2010 Outlook VBA and Custom Forms 1
O modify vba to run it as script rule Outlook VBA and Custom Forms 8
P How many subs can run in one outlook VBA script Using Outlook 5
J Email Parsing VBA Script for Outlook - NEEDED Outlook VBA and Custom Forms 7
P Vba script including macro appears in rules but wont run Outlook VBA and Custom Forms 6
R Adding vba to script list Outlook VBA and Custom Forms 4
F VBA script to highlight specific words Outlook VBA and Custom Forms 1
D VBA Script to extract text matching specific criteria Outlook VBA and Custom Forms 1
D VBA Script (Ask to where to save send mail) Outlook VBA and Custom Forms 1
D VBA script to auto download attachments and rename file according to subject line Outlook VBA and Custom Forms 23
Hudas Outlook VBA script reverting back to previous changes Outlook VBA and Custom Forms 2
J Outlook 2007 Rules & VBA: How to run a script on a report message (ReportItem) Using Outlook 14
V "Accept + Send the Response now", VBA script? Using Outlook 1
R Addins4Outlook TagIt! addin script or VBA module? Using Outlook 2
S Outlook VBA rule script to process both MailItem and MeetingItem Using Outlook 0
A VBA Script to Forward Spam to AntiSpam Provider Using "Blank" Form Outlook VBA and Custom Forms 2
L Limit VBA Script to one Outlook account Using Outlook 1
P Tweak vba so it can target another mailbox Outlook VBA and Custom Forms 1
A Outlook 2010 VBA fails to launch Outlook VBA and Custom Forms 2
richardwing Outlook 365 VBA to access "Other Actions" menu for incoming emails in outlook Outlook VBA and Custom Forms 0
W Create a Quick Step or VBA to SAVE AS PDF in G:|Data|Client File Outlook VBA and Custom Forms 1
C Outlook (desktop app for Microsoft365) restarts every time I save my VBA? Using Outlook 0
D VBA Macro to Print and Save email to network location Outlook VBA and Custom Forms 1
TedSch Small vba to kill political email Outlook VBA and Custom Forms 3
E Outlook 365 Outlook/VBA Outlook VBA and Custom Forms 11
N VBA Macro To Save Emails Outlook VBA and Custom Forms 1
Z VBA Forward vs manual forward Outlook VBA and Custom Forms 2
J VBA Cannot programmatically input or change Value for User Defined field Using Outlook 1
J VBA for outlook to compare and sync between calendar Outlook VBA and Custom Forms 1
A Any way to force sort by/group by on search results with VBA? Outlook VBA and Custom Forms 1
E Default shape via VBA Outlook VBA and Custom Forms 4
A Change settings Send/receive VBA Outlook VBA and Custom Forms 0
Z Import Tasks from Access Using VBA including User Defined Fields Outlook VBA and Custom Forms 0
E Outlook VBA change GetDefaultFolder dynamically Outlook VBA and Custom Forms 6
justicefriends How to set a flag to follow up using VBA - for addressee in TO field Outlook VBA and Custom Forms 11
M add new attendee to existing meetings with VBA Outlook VBA and Custom Forms 5
D VBA code to select a signature from the signatures list Outlook VBA and Custom Forms 3

Similar threads

Top