Home » Outlook » Macro to Remove Duplicate Emails in Outlook – A Free Solution

Macro to Remove Duplicate Emails in Outlook – A Free Solution

author
Published By Nilesh
Aswin Vijayan
Approved By Aswin Vijayan
Published On January 23rd, 2024
Reading Time 4 Minutes Reading

Seeking for a free solution to remove duplicate emails from Outlook, then this blog is for you. Here we are going to discuss macro to remove duplicate emails in Outlook. So, stay with us to know the fix.

Basically, a macro is a set of saved commands that can be recalled with a single command or key. It is written in VBA script that stands for Visual Basic Application Script. It gives you the power to complete a task that is not possible via manual options.

Because it is free so there are many Outlook users who are facing a duplicate email issue in Outlook want to know about this technique. But before starting the procedure of macro to remove duplicate emails in Outlook keep some important notes in your mind.

  • The procedure contains a programming concept then be careful while doing the scripting part.
  • Any error during the procedure may lead to data loss of your Outlook

VBA Marco to Remove Duplicate Emails in Outlook

Follow the sets of instructions below to complete the data without any data loss.

  • 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, in the VBA editor window, and double click to open a module which is in use or you can directly insert a new module by clicking on Insert and then Module
  • In the next step copy and paste the below VBA codes into the module

Sub RemoveDuplicateItems()
Dim objFolder As Folder
Dim objDictionary As Object
Dim i As Long
Dim objItem As Object
Dim strKey As String

Set objDictionary = CreateObject(“scripting.dictionary”)
‘Select a source folder
Set objFolder = Outlook.Application.Session.PickFolder

If Not (objFolder Is Nothing) Then
For i = objFolder.Items.Count To 1 Step -1
Set objItem = objFolder.Items.Item(i)

Select Case objFolder.DefaultItemType
‘Check email subject, body and sent time
Case olMailItem
strKey = objItem.Subject & “,” & objItem.Body & “,” & objItem.SentOn
‘Check appointment subject, start time, duration, location and body
Case olAppointmentItem
strKey = objItem.Subject & “,” & objItem.Start & “,” & objItem.Duration & “,” & objItem.Location & “,” & objItem.Body
‘Check contact full name and email address
Case olContactItem
strKey = objItem.FullName & “,” & objItem.Email1Address & “,” & objItem.Email2Address & “,” & objItem.Email3Address
‘Check task subject, start date, due date and body
Case olTaskItem
strKey = objItem.Subject & “,” & objItem.StartDate & “,” & objItem.DueDate & “,” & objItem.Body
End Select

strKey = Replace(strKey, “, “, Chr(32))

‘Remove the duplicate items
If objDictionary.Exists(strKey) = True Then
objItem.Delete
Else
objDictionary.Add strKey, True
End If
Next i
End If
End Sub

  • Once the script is done, now digitally sign this macro and change the Outlook macro security to its low
  • After that, you can run this new VBA project. To do this click on the “Run” icon in the toolbar
  • Select the folder to move the duplicate emails form Outlook

Automated Way to Remove Duplicate Emails in Outlook

Note: Well, 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 emails from Outlook

save outlook attachments to folder

The Outlook Duplicate Remover is one of the best and most searched toolkits. 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 Emails

1. First Download and install the software on your computer

2. Select Add File(s) or Add Folder option

3. Choose the Within Folder option from Duplicate Option

4. Choose the Destination location

5. Select Emails option from Select filter and duplicate criteria

6. Choose the property from Specific Duplicate Criteria

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

Conclusion

There are lots of users seeking a free solution to remove Outlook duplicate emails in Outlook. Hence, here in this section, we have discussed the macro to remove duplicate emails in Outlook. In addition, we have discussed an automated method to remove duplicate emails in Outlook.