一些用户在查看日历中的生日活动时还希望看到相应人员的年龄。 因此,在本文中,我们将分享一种轻松实现这一想法的方法。
当您将生日信息添加到联系人时,Outlook 会自动在日历中创建一个生日事件。 在这种情况下,每次在日历中看到生日事件时,可能还想获取对应的人的年龄。 因此,在这里我们将向您介绍一种实现方式。
在列表视图中显示所有生日事件对应人的年龄
- 首先,启动 Outlook VBA 编辑器。
- 然后,将以下代码复制到模块中。
Sub ShowAgesOfBirthdayEventsListView()
Dim objStore As Outlook.Store
Dim objOutlookFile As Outlook.Folder
Dim objFolder As Outlook.Folder
'Process All Calendar Folders in Your Outlook
For Each objStore In Outlook.Application.Session.Stores
Set objOutlookFile = objStore.GetRootFolder
For Each objFolder In objOutlookFile.Folders
If objFolder.DefaultItemType = olAppointmentItem Then
Call ProcessFolders(objFolder)
End If
Next
Next
End Sub
Sub ProcessFolders(ByVal objCalendar As Outlook.Folder)
Dim i As Integer
Dim objItem As Object
Dim objBirthdayEvent As Outlook.AppointmentItem
Dim dStart, dBirth As Date
Dim nAge As Integer
Dim objNewProperty As Outlook.UserProperty
Dim objSubCalendar As Outlook.Folder
For i = objCalendar.Items.Count To 1 Step -1
Set objItem = objCalendar.Items.Item(i)
'Add "Age" Property to Birthday Events
If (objItem.MeetingStatus = olNonMeeting) And (objItem.IsRecurring = True) And (Right(objItem.Subject, 11) = "'s Birthday") Then
Set objBirthdayEvent = objItem
dStart = objBirthdayEvent.Start
'Count Age
dCurrentBirthday = DateSerial(Year(Now), Month(dStart), Day(dStart))
nAge = DateDiff("yyyy", dStart, dCurrentBirthday)
Set objNewProperty = objBirthdayEvent.UserProperties.Find("Age", True)
If objNewProperty Is Nothing Then
Set objNewProperty = objBirthdayEvent.UserProperties.Add("Age", olText, True)
End If
objNewProperty.value = nAge
objBirthdayEvent.Save
End If
Next
'Process All Sub-Calendar Folders Recursively
If objCalendar.Folders.Count > 0 Then
For Each objSubCalendar In objCalendar.Folders
Call ProcessFolders(objSubCalendar)
Next
End If
End Sub
- 之后,将光标置于第一个子程序中,按“F5”运行该宏。
- 宏完成后,退出 VBA 编辑器并打开一个日历文件夹。
- 随后,转到“查看”选项卡并单击“更改视图”>“列表”。
- 接下来,单击“查看设置”按钮。
- 在弹出的对话框中,选择“列”。
- 然后,在“显示列”的下一个对话框中,从“选择可用字段自”列表中选择“文件夹中的用户定义字段”。
- 稍后,在“可用列”框中选中“年龄”,然后单击“添加 ->”按钮。
- 最后,单击一系列“确定”,直到返回到日历项目列表。
- 现在,在列表中,你可以看到所有生日事件的人物年龄,如下图所示。
修复受损的 Outlook 文件
遇到时你可能会感到恐慌 腐败的前景 文件,其中包含许多您宝贵的电子邮件和日程安排。 虽然这样的事情很让人绝望,但还是要赶紧冷静下来,考虑采取有效的措施。 如果你一直担心,情况会变得越来越糟。 实际上,有多种方法和实用程序可以修复损坏的文件,例如收件箱修复工具和更强大且经验丰富的工具,例如 DataNumen Outlook Repair.
作者简介:
Shirley Zhang 是一位数据恢复专家 DataNumen, Inc.,它是数据恢复技术领域的世界领先者,包括 SQL Server 固定 和 outlook 修复软件产品。 欲了解更多信息,请访问 datanumen.com




