Outlook: How to remove duplicate calendar items
Sometimes, there are some duplicate calendar items when we import events from other devices. To remove the duplicate calendar items, this tutorial introduces two different methods, one is removing one by one when the duplicates are fewer, another one is using VBA to remove all duplicates at once time.
Manually remove duplicates calendar items one by one
VBA to remove duplicates calendar items at once time
- Automate emailing with Auto CC/BCC, Auto Forward by rules; send Auto Reply (Out of Office) without requiring an exchange server...
- Get reminders like BCC Warning when replying to all while you're in the BCC list, and Remind When Missing Attachments for forgotten attachments...
- Improve email efficiency with Reply (All) With Attachments, Auto Add Greeting or Date & Time into Signature or Subject, Reply Multiple Emails...
- Streamline emailing with Recall Emails, Attachment Tools (Compress All, Auto Save All...), Remove Duplicates, and Quick Report...
Manually remove duplicates calendar items one by one
To remove duplicate calendar items one by one, you need to list them in a specific order for viewing the duplicates clearly firstly, then remove them one by one.
1. Generally, the calendar is in a Calendar view, activate the calendar you want to remove duplicates, then click View > Change View > List.
Now the calendar has been viewed as a list.
2. Then specify a condition that you use to compare if the items are duplicate, supposing to compare if the items have the same subject. Click SUBJECT in the calendar list, then all items with the same subject are placed together.
3. Now you can remove the items which have the same subject one by one by right-clicking on the item and clicking Delete from the popping context menu.
VBA to remove duplicates calendar items at once time
Here introduces some VBA which can remove all duplicate calendar items in a calendar folder in different cases.
1. Press Alt + F11 keys to enable Microsoft Visual Basic for Applications window.
2. Click Insert > Module to create a new blank module, then copy and paste below code to the module.
VBA: remove all duplicate calendar items in one specific category
'Sub RemoveDuplicateCalendar()
'UpdatebyExtendoffice20220413
Dim xStores As Stores
Dim xStore As Store
Dim xRootFolder As Folder
Dim xFolder As Object
Set xStores = Application.Session.Stores
For Each xStore In xStores
Set xRootFolder = xStore.GetRootFolder
For Each xFolder In xRootFolder.Folders
Call ProcessFolders(xFolder)
Next
Next
Set xStores = Nothing
End Sub
Sub ProcessFolders(ByVal CurrentFld As Folder)
Dim xDictionary As Object
Dim i As Long
Dim xItem As Object
Dim xKey As String
Dim xSubFld As Folder
On Error Resume Next
If CurrentFld.DefaultItemType <> olAppointmentItem Then Exit Sub
Set xDictionary = CreateObject("Scripting.Dictionary")
For i = CurrentFld.Items.Count To 1 Step -1
Set xItem = CurrentFld.Items.Item(i)
'change categories as you need in below script
If xItem.Categories = "date" Then
'change the comparing items as you need
xKey = xItem.Subject & xItem.Location & xItem.Body & xItem.Categories
If xDictionary.Exists(xKey) = True Then
xItem.Delete
Else
xDictionary.Add xKey, True
End If
End If
Next i
For Each xSubFld In CurrentFld.Folders
ProcessFolders xSubFld
Next
End Sub
In this VBA, it will remove all duplicates in “date” this category by comparing the subject, location, body and category, you can change them as you need.
3. then press F5 key or click Run to run the code, a dialog Macros pops out, choose RemoveDuplicateCalendar and click Run .
Then the duplicate items in the “date” category have been removed.
VBA: remove all duplicate calendar items across categories
Sub RemoveDuplicateCalendar()
'UpdatebyExtendoffice20220413
Dim xStores As Stores
Dim xStore As Store
Dim xRootFolder As Folder
Dim xFolder As Object
Set xStores = Application.Session.Stores
For Each xStore In xStores
Set xRootFolder = xStore.GetRootFolder
For Each xFolder In xRootFolder.Folders
Call ProcessFolders(xFolder)
Next
Next
Set xStores = Nothing
End Sub
Sub ProcessFolders(ByVal CurrentFld As Folder)
Dim xDictionary As Object
Dim i As Long
Dim xItem As Object
Dim xKey As String
Dim xSubFld As Folder
On Error Resume Next
If CurrentFld.DefaultItemType <> olAppointmentItem Then Exit Sub
Set xDictionary = CreateObject("Scripting.Dictionary")
For i = CurrentFld.Items.Count To 1 Step -1
Set xItem = CurrentFld.Items.Item(i)
'change the comparing items as you need
xKey = xItem.Subject & xItem.Location & xItem.Body & xItem.Categories
If xDictionary.Exists(xKey) = True Then
xItem.Delete
Else
xDictionary.Add xKey, True
End If
Next i
For Each xSubFld In CurrentFld.Folders
ProcessFolders xSubFld
Next
End Sub
Run this code, all duplicates which are at the same subject, location, body, category in each category have been removed.
Note: Above VBA works in calendar folder includes subfolder.
Best Office Productivity Tools
Kutools for Outlook - Over 100 Powerful Features to Supercharge Your Outlook
🤖 AI Mail Assistant: Instant pro emails with AI magic--one-click to genius replies, perfect tone, multilingual mastery. Transform emailing effortlessly! ...
📧 Email Automation: Out of Office (Available for POP and IMAP) / Schedule Send Emails / Auto CC/BCC by Rules When Sending Email / Auto Forward (Advanced Rules) / Auto Add Greeting / Automatically Split Multi-Recipient Emails into Individual Messages ...
📨 Email Management: Easily Recall Emails / Block Scam Emails by Subjects and Others / Delete Duplicate Emails / Advanced Search / Consolidate Folders ...
📁 Attachments Pro: Batch Save / Batch Detach / Batch Compress / Auto Save / Auto Detach / Auto Compress ...
🌟 Interface Magic: 😊More Pretty and Cool Emojis / Boost Your Outlook Productivity with Tabbed Views / Minimize Outlook Instead of Closing ...
👍 One-click Wonders: Reply All with Incoming Attachments / Anti-Phishing Emails / 🕘Show Sender's Time Zone ...
👩🏼🤝👩🏻 Contacts & Calendar: Batch Add Contacts From Selected Emails / Split a Contact Group to Individual Groups / Remove Birthday Reminders ...
Over 100 Features Await Your Exploration! Click Here to Discover More.