Some users would like to also see the corresponding person’s age when viewing a birthday event in the calendar. Therefore, in this article, we’ll share a method to make this idea come true with ease.
When you add the birthday information to a contact, Outlook will auto create a birthday event in the calendar. Under this circumstance, every time when you see birthday events in the calendar, you may also want to get the corresponding persons’ ages. Thus, here we will introduce you a way to realize it.
Show the Corresponding Persons’ Ages for All Birthday Events in List View
- At the very beginning, launch Outlook VBA editor.
- Then, copy the following code into a module.
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
- After that, put cursor in the first subroutine and press “F5” to run this macro.
- When macro finishes, exit the VBA editor and open a calendar folder.
- Subsequently, go to “View” tab and click “Change View” > “List”.
- Next, click “View Settings” button.
- In the popup dialog box, choose “Columns”.
- Then, in the next dialog box of “Show Columns”, select “User-defined fields in folder” from the list of “Select available fields from”.
- Later, pitch on “Age” in “Available columns” box and click “Add ->” button.
- Eventually, click a series of “OK” until going back to the calendar item list.
- Now, in the list, you can see the persons’ ages of all birthday events, as shown in the following figure.
Fix Compromised Outlook File
You may get panic when encountering corrupt Outlook file which contains a lot of your valuable emails and schedules. Notwithstanding that such issue is pretty desperate, you still have to calm down at once and consider effective measures. If you keep worried, situation can get worse and worse. Actually, there are multiple ways and utilities that can repair the damaged file, such as inbox repair tool and a more robust and experienced tool, like DataNumen Outlook Repair.
Author Introduction:
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including SQL Server fix and outlook repair software products. For more information visit www.datanumen.com