Create One Outlook Email per Unique Address with Excel VBA
Question details
Create one Outlook email for each unique email address in an Excel worksheet, combining that recipient's records in the message.

- Product
- Microsoft Excel VBA and Microsoft Outlook
- Device & OS
- not provided
- Scenario
- A worksheet contains multiple records for some recipients, and each recipient should receive a single message containing their associated records.
- Observed behavior
- The desired result is one email per unique address, with a shared CC address and the recipient's records collected in the body.
This example requires desktop Excel for Windows and a configured classic Outlook installation that supports COM automation; new Outlook does not support this automation method. Arrange the active worksheet with headers in row 1, email addresses in column A, record numbers in column B, and record details in column C.
Group Worksheet Records and Create Outlook Emails with VBA
Use a temporary worksheet to find unique addresses, then build one Outlook draft for each recipient.
The example trims and compares addresses without regard to case. It uses the first matching record number in the subject, a fixed CC address, and all matching rows in the body.
The macro displays messages for review rather than sending them. It assumes the active worksheet contains the data and that each email address occupies a single cell.
In desktop Excel, select the worksheet containing your records. Press Alt+F11, then choose Insert > Module.
Paste the following code into the module. Replace the CC address and introductory text with your own values: Sub CreateEmailsByAddress() Dim ws As Worksheet, temp As Worksheet Dim outlookApp As Object, mail As Object Dim lastRow As Long, uniqueLast As Long Dim i As Long, j As Long Dim address As String, firstNumber As String, bodyText As String Dim errorText As String, oldAlerts As Boolean Set ws = ActiveSheet lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row If lastRow < 2 Then MsgBox "No email addresses found." Exit Sub End If oldAlerts = Application.DisplayAlerts On Error GoTo HandleError Set temp = ws.Parent.Worksheets.Add temp.Cells(1, 1).Value = "Email" For i = 2 To lastRow temp.Cells(i, 1).Value = LCase$(Trim$(CStr(ws.Cells(i, 1).Value))) Next i temp.Range("A1:A" & lastRow).RemoveDuplicates Columns:=1, Header:=xlYes uniqueLast = temp.Cells(temp.Rows.Count, "A").End(xlUp).Row Set outlookApp = CreateObject("Outlook.Application") For i = 2 To uniqueLast address = CStr(temp.Cells(i, 1).Value) If Len(address) > 0 Then firstNumber = "" bodyText = "Hello," & vbCrLf & vbCrLf & "Your records:" & vbCrLf For j = 2 To lastRow If LCase$(Trim$(CStr(ws.Cells(j, 1).Value))) = address Then If Len(firstNumber) = 0 Then firstNumber = CStr(ws.Cells(j, 2).Value) bodyText = bodyText & CStr(ws.Cells(j, 2).Value) & " - " & CStr(ws.Cells(j, 3).Value) & vbCrLf End If Next j Set mail = outlookApp.CreateItem(0) With mail .To = address .CC = "cc@example.com" .Subject = "Records - " & firstNumber .Body = bodyText .Display End With End If Next i GoTo CleanUp HandleError: errorText = Err.Description CleanUp: On Error Resume Next Application.DisplayAlerts = False If Not temp Is Nothing Then temp.Delete Application.DisplayAlerts = oldAlerts On Error GoTo 0 If Len(errorText) > 0 Then MsgBox "Macro stopped: " & errorText End Sub
Return to the data worksheet, press Alt+F8, select CreateEmailsByAddress, and click Run. Review each displayed Outlook message for the correct recipient, CC, subject, and records.
Send the reviewed messages from Outlook. If you later want automatic sending, change .Display to .Send in the VBA editor only after verifying the output and your organization's sending policies.

Manage Recipient Lists in WPS Spreadsheet
WPS Office is a free, lightweight alternative with a familiar interface for working with spreadsheets. Open compatible Excel files and migrate everyday worksheet tasks easily; the Excel-to-Outlook VBA automation above still requires the specified Microsoft applications.

Frequently Asked Questions
How does the macro avoid creating multiple emails for the same address?
It copies normalized addresses to a temporary worksheet and uses RemoveDuplicates. It then loops through that unique list and collects all matching rows for each address.
Can I review the emails before sending them?
Yes. The example uses .Display to open each message in Outlook. Review and send the messages manually, or change .Display to .Send only after testing.
Which record number appears in the subject?
The example uses the first nonblank record number found in column B for that recipient. Change the subject-building logic in the matching loop if you need a different rule.
Can the macro use different CC addresses from each row?
Not as written: the .CC property contains one fixed address. To use row-specific CC values, add a CC column and modify the matching loop to collect and deduplicate those addresses.
Will this work with new Outlook?
This example uses Outlook COM automation and requires classic Outlook on Windows. New Outlook does not support this automation method.




