Home » Blog » Outlook » VBA to Remove Outlook Duplicate Recipients – A Free Solution

VBA to Remove Outlook Duplicate Recipients – A Free Solution

Admin | Modified: 2020-11-09T14:59:06+00:00|Outlook | 4 Minutes Reading

This whole article is based on the VBA to remove Outlook Duplicate recipients. So stay with us till the last to know the best answer for the same

As we know that there are lots of professionals using Outlook for their mailing needs But while composing an email they will encounter duplicate recipients. The problem is when they have to deal with the new unnecessary task then it becomes very frustrating for them.

So to make the task easier for the professionals. Here in this blog, we are going to discuss and free manual techniques to remove duplicate Outlook recipients using VBA codes.

What is VBA Codes?

VBA code is a scripting language so with the help of Visual Basic for Applications language you can create macros and easily control Outlook. With the help of these VBA macros, you will perform all the complex tasks that are not possible by default. It allows taking all the advantages of the Outlook object model including with application level.

VBA to Remove Outlook Duplicate Recipients

VBA scripting is a complex task so you need to be extra careful while performing it. Also, follow the steps mentioned below because any mistakes can delete your important data from Outlook

  • First, run the Outlook program
  • Now click Alt+F11 to open Visual Basic editor or you can switch the developer option then click on the Visual Basic
  • Now from the VBA window open a blank module
  • After that copy and paste the following VBA codes into the module

Sub RemoveDuplicateRecipients()
Dim objCurrentMail As MailItem
Dim objRecipients As Recipients
Dim ContactGroupFound As Boolean
Dim i, n As Long

Set objCurrentMail = ActiveInspector.CurrentItem
ContactGroupFound = True

While ContactGroupFound = True
Set objRecipients = objCurrentMail.Recipients
ContactGroupFound = False

‘Expand the contact groups in “To” field
For i = objRecipients.Count To 1 Step -1
If objRecipients(i).AddressEntry.DisplayType <> olUser Then
For n = 1 To objRecipients(i).AddressEntry.Members.Count
If objRecipients(i).AddressEntry.Members.Item(n).DisplayType = olUser Then
objCurrentMail.Recipients.Add (objRecipients(i).AddressEntry.Members.Item(n).Address)
Else
objCurrentMail.Recipients.Add (objRecipients(i).AddressEntry.Members.Item(n).Name)
ContactGroupFound = True
End If
Next
objRecipients(i).Delete
End If
Next i
objRecipients.ResolveAll
Wend

‘Remove the duplicate recipients
For i = objRecipients.Count To 1 Step -1
For n = (i – 1) To 1 Step -1
If objRecipients(i).Address = objRecipients(n).Address Then
objRecipients(i).Delete
Exit For
End If
Next
Next
End Sub

  • Once pasting is done add the VBA project in the Quick Access Toolbar
  • Now, set the Outlook macro security level to low
  • After all this now you can try this code.
  • So to try this code compose any email
  • Then add contact group and contacts in To field
  • Select Marco button in Quick Access Toolbar
  • After that Outlook automatically expand the contact group and then remove the duplicate recipients

Best Secure Way to Remove Duplicate Recipients From Outlook

If you this VBA to remove Outlook duplicate recipients is complex or complicated? Also, the VBA codes are not for normal users only technique users can use this method. Hence here in this section, we are going to introduce you to the best and most secure way to delete duplicate recipients from Outlook

outlook attachment extractor extract attachments from selective folders

SysTools Outlook Duplicate Remover is one of the best and most searched toolkit. This tool is capable to delete all kinds of duplicate items from Outlook such as emails, contacts, tasks, calendars, notes, and journals. Also, the tool has an amazing UI that is so straightforward and anyone can easily understand it. This tool is capable to delete duplicate from Outlook PST, OST, and BAK files also support all Outlook versions.

Steps To Remove Outlook Duplicate Recipients

1. First Download and install the software on your computer

2. Launch the software and select Add File(s) or Add Folder option

3. Now, choose the Within Folder option from Duplicate Option

4. Choose the destination location

5. Select Contacts option from Select filter and duplicate criteria

6. Choose the property from Specific Duplicate Criteria

7. After all done, click on the Next button to start the process

Conclusion

There are lots of users seeking a free solution to remove duplicate items from Outlook and VBA to remove Outlook duplicate recipients is one of them. Hence in the above write-up, we have discussed the detailed VBA method to remove duplicate contacts from Outlook. In addition, we have also discussed an automated method if you find the VBA method is complicated.