如果您想始终将所有日历中的所有约会和会议合并到一个日历中以方便查看,您可以使用本文介绍的方法。
也许您在 Outlook 中配置了很多电子邮件帐户。 在这种情况下,您的 Outlook 中必须有许多日历。 因此,每次要查看今天有多少约会时,都必须切换到所有日历。 会有点麻烦。 那么,为什么不将它们合并到一个日历中呢? 下面我们将公开一段VBA代码,可以轻松实现。

自动合并所有日历中的所有约会和会议
- 首先,启动您的 Outlook 应用程序。
- 进入 Outlook 主窗口后,按“Alt + F11”键按钮。
- 然后您将进入“Microsoft Visual Basic for Applications”窗口。
- 接下来,您需要找到并打开“ThisOutlookSession”项目。
- 随后,您应该将以下 VBA 代码复制并粘贴到该项目窗口中。
'Here we take two calendars as an example - "Calendar A" & "Calendar B"
'You can add more as per your needs
Dim WithEvents objACalendarItems As Outlook.Items
Dim WithEvents objBCalendarItems As Outlook.Items
Dim objDefaultCalendar As Outlook.Folder
Private Sub Application_Startup()
Set objACalendarItems = Application.Session.folders("File A").folders("Calendar").Items
Set objBCalendarItems = Application.Session.folders("File B").folders("Calendar").Items
'Here we merge into the default calendar
Set objDefaultCalendar = Application.Session.GetDefaultFolder(olFolderCalendar)
End Sub
Private Sub objACalendarItems_ItemAdd(ByVal Item As Object)
Call CopyToDefaultCalendar(Item)
End Sub
Private Sub objBCalendarItems_ItemAdd(ByVal Item As Object)
Call CopyToDefaultCalendar(Item)
End Sub
Private Sub CopyToDefaultCalendar(ByVal objItem As Object)
Dim objCopiedAppointment As Outlook.AppointmentItem
Dim objMoviedAppointment As Outlook.AppointmentItem
Dim strPSTFileName As String
Set objCopiedAppointment = objItem.Copy
Set objMoviedAppointment = objCopiedAppointment.Move(objDefaultCalendar)
strPSTFileName = objItem.parent.parent.Name
'Tag the source of the copied appointments
objMoviedAppointment.Categories = "From " & strPSTFileName
objMoviedAppointment.Save
'If want to delete it from the original calendar, add the following line:
'objItem.Delete
End Sub
- 之后,您需要为当前宏分配一个数字证书。
- 稍后转到“宏设置”以允许数字签名的宏。
- 最后,您可以重启 Outlook 程序来激活新的宏。
- 从现在开始,每次在非默认日历中添加任何新约会或会议时,它都会自动复制到默认日历中,如下图所示:
及时从日历中删除过期项目
我们知道,当邮箱越来越大时,Outlook 更容易出现各种错误。 因此,建议及时清除邮箱中无用的项目,如逾期的约会、会议等。 同时,最好在附近放一个强力维修工具,例如 DataNumen Outlook Repair。 它可以 修复 Outlook 问题不费吹灰之力。
作者简介:
Shirley Zhang 是一位数据恢复专家 DataNumen, Inc.,它是数据恢复技术领域的世界领先者,包括 sql恢复 和 outlook 修复软件产品。 欲了解更多信息,请访问 datanumen.com

