跳至主要内容

Outlook:如何删除重复的日历项目

Author: Sun Last Modified: 2025-05-07

有时,当我们从其他设备导入事件时,会出现一些重复的日历项目。为了删除这些重复的日历项目,本教程介绍了两种不同的方法:一种是在重复项较少时逐个删除;另一种是使用VBA一次性删除所有重复项。

手动逐个删除重复的日历项目

使用VBA一次性删除重复的日历项目


手动逐个删除重复的日历项目

 

要逐个删除重复的日历项目,首先需要按特定顺序列出它们,以便清楚地查看重复项,然后逐一删除。

1. 通常情况下,日历处于“日历”视图中,激活您要删除重复项的日历,然后点击“视图” > “更改视图” > “列表”。

steps on manually removing duplicates calendar items one by one

现在,日历已以列表形式显示。

steps on manually removing duplicates calendar items one by one
steps on manually removing duplicates calendar items one by one

2. 然后指定一个条件用于比较项目是否重复,例如比较项目是否有相同的主题。在日历列表中点击“主题”,那么所有具有相同主题的项目将被排列在一起。

steps on manually removing duplicates calendar items one by one

3. 现在,您可以右键单击具有相同主题的项目并从弹出的上下文菜单中选择“删除”,从而逐个删除这些项目。

steps on manually removing duplicates calendar items one by one

Outlook中的AI邮件助手:更智能的回复,更清晰的沟通(一键搞定!) 免费

使用Kutools for Outlook的AI邮件助手简化您的日常Outlook任务。这一强大工具会从您过去的邮件中学习,提供智能化且精准的回复建议,优化您的邮件内容,并帮助您轻松起草和润色邮件。
doc ai email handle

该功能支持:

  • 智能回复:根据您以往的对话生成量身定制、精准且即用的回复。
  • 增强内容:自动优化您的邮件文本,使其更加清晰且有影响力。
  • 轻松撰写:只需提供关键字,AI即可完成其余工作,并支持多种写作风格。
  • 智能扩展:通过上下文感知的建议扩展您的思路。
  • 总结概括:快速获取长邮件的简洁概述。
  • 全球覆盖:轻松将您的邮件翻译成任何语言。

该功能支持:

  • 智能邮件回复
  • 优化后的内容
  • 基于关键字的草稿
  • 智能内容扩展
  • 邮件总结
  • 多语言翻译

最重要的是,此功能永久完全免费不要再犹豫了——立即下载AI邮件助手并体验吧


使用VBA一次性删除重复的日历项目

 

这里介绍了一些VBA代码,可以在不同情况下删除日历文件夹中的所有重复日历项目。

1. 按下 Alt + F11 键以启用“Microsoft Visual Basic for Applications”窗口。

2. 点击“插入” > “模块”以创建一个新的空白模块,然后复制并将以下代码粘贴到该模块中。

VBA:删除某一特定类别中的所有重复日历项目

'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

在此VBA中,它将通过比较主题、地点、正文和类别来删除“日期”类别中的所有重复项,您可以根据需要进行更改。

steps on using VBA to remove duplicates calendar items at once time

3. 然后按下F5 键或点击运行以运行代码,会弹出一个“宏”对话框,选择 RemoveDuplicateCalendar 并点击“运行”。steps on using VBA to remove duplicates calendar items at once time .

steps on using VBA to remove duplicates calendar items at once time

然后,“日期”类别中的重复项已被删除。

VBA:跨类别删除所有重复的日历项目

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

运行此代码后,每个类别中具有相同主题、地点、正文和类别的所有重复项都将被删除。

steps on using VBA to remove duplicates calendar items at once time
steps on using VBA to remove duplicates calendar items at once time

注意:上述VBA适用于包含子文件夹的日历文件夹。