How to Show the Corresponding Persons’ Ages for All Birthday Events in List View of Outlook Calendar

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

  1. At the very beginning, launch Outlook VBA editor.
  2. 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

VBA Code - Show the Corresponding Persons' Ages for All Birthday Events in List View

  1. After that, put cursor in the first subroutine and press “F5” to run this macro.
  2. When macro finishes, exit the VBA editor and open a calendar folder.
  3. Subsequently, go to “View” tab and click “Change View” > “List”.Change to List View
  4. Next, click “View Settings” button.
  5. In the popup dialog box, choose “Columns”.Columns
  6. Then, in the next dialog box of “Show Columns”, select “User-defined fields in folder” from the list of “Select available fields from”.
  7. Later, pitch on “Age” in “Available columns” box and click “Add ->” button.Add Age Column
  8. Eventually, click a series of “OK” until going back to the calendar item list.
  9. Now, in the list, you can see the persons’ ages of all birthday events, as shown in the following figure.Person Age for Birthday Events

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

Comments are closed.