Skip to main content

How to calculate and show ages by birthdays on Outlook calendar?

Author: Kelly Last Modified: 2017-08-07

Generally speaking, a contact’s birthday will be automatically added as a yearly recurring appointment in the calendar. But do you know how to calculate the contact’s age and show the age directly in the calendar view? This article will introduce a VBA to figure out each contact’s age and show the age on the subject of relative recurring appointment in Outlook.

Calculate and show ages by birthdays on Outlook calendar

Office Tab - Enable Tabbed Editing and Browsing in Microsoft Office, Making Work a Breeze
Unlock Kutools for Outlook's free version now and enjoy over 70 features with unlimited access forever
Boost your Outlook 2021 - 2010 or Outlook 365 with these advanced features. Enjoy a fully functional 30-day free trial and elevate your email experience!

arrow blue right bubbleCalculate and show ages by birthdays on Outlook calendar

To calculate each contact’s age and show the age in the subject of relative recurring appointment in Outlook calendar, please do as follows:

1. Open the default calendar folder, and press Alt + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and then paste below VBA code into the new module window.

VBA: Calculate and show contacts’ ages in Outlook calendar

Option Explicit
Public Sub UpdateAges()
Dim xOlApp As Outlook.Application
Dim xOlFolder As Outlook.Folder
Dim xOlItems As Outlook.Items
Dim xAppointmentItem As AppointmentItem
Dim xAge As Integer
Dim xOlProp As Outlook.UserProperty
Set xOlApp = Outlook.Application
Set xOlFolder = Session.GetDefaultFolder(olFolderCalendar)
Set xOlItems = xOlFolder.Items
For Each xAppointmentItem In xOlItems
If (InStr(1, xAppointmentItem.Subject, "Birthday") Or InStr(1, xAppointmentItem.Subject, "Anniversary")) And xAppointmentItem.IsRecurring = True Then
With xAppointmentItem
If xAppointmentItem.UserProperties("Original Subject") Is Nothing Then
Set xOlProp = xAppointmentItem.UserProperties.Add("Original Subject", olText, True)
xOlProp.Value = .Subject
End If
xAge = DateDiff("yyyy", .Start, Date)
.Subject = .UserProperties("Original Subject") & " (" & xAge & " in " & Format(Date, "yyyy") & ")"
End With
End If
Set xAppointmentItem = Nothing
Set xOlItems = Nothing
Set xOlFolder = Nothing
Set xOlApp = Nothing
End Sub

3. Press the F5 key or the Run button to run this VBA.

When you return to the default calendar, you will see each contact’s age is figured out and shown in the subject of the recurring birthday appointment. See screenshot:

(1) In the subject of a certain contact’s recurring birthday appointment, this contact’s age is embraced by parentheses similar as (41 in 2017), 41 is the age, and 2017 is the current year.
(2) If you change a certain contact’s birthday in contact folder, the age will be removed from the calendar automatically.
(3) This VBA work with the default Outlook calendar only.

arrow blue right bubbleRelated Articles

Best Office Productivity Tools

Breaking News: Kutools for Outlook Launches Free Version!

Unlock 100+ powerful features with a 30-day free trial; 70+ remain free forever post-trial. Click to see all free features!

🤖 Kutools AI : Instant pro emails with AI magic--one-click to genius replies, perfect tone, multilingual mastery. Transform emailing effortlessly! ...

📧 Email Automation: Auto Reply (Available for POP and IMAP)  /  Schedule Send Emails  /  Auto CC/BCC by Rules When Sending Email  /  Auto Forward (Advanced Rules)   /  Auto Add Greeting   /  Automatically Split Multi-Recipient Emails into Individual Messages ...

📨 Email Management: Recall Emails  /  Block Scam Emails by Subjects and Others  /  Delete Duplicate Emails  /  Advanced Search  /  Consolidate Folders ...

📁 Attachments ProBatch Save  /  Batch Detach  /  Batch Compress  /  Auto Save   /  Auto Detach  /  Auto Compress ...

🌟 Interface Magic: 😊More Pretty and Cool Emojis   /  Remind you when important emails come  /  Minimize Outlook Instead of Closing ...

👍 One-click Wonders: Reply All with Incoming Attachments  /   Anti-Phishing Emails  /  🕘Show Sender's Time Zone ...

👩🏼‍🤝‍👩🏻 Contacts & Calendar: Batch Add Contacts From Selected Emails  /  Split a Contact Group to Individual Groups  /  Remove Birthday Reminders ...

Instantly unlock Kutools for Outlook with a single click—permanently free. Don't wait, download now and boost your efficiency!

Read More       Free Download      Purchase


Comments (3)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
MsgBox "Fertig!" & vbCrLf & Zaehler & " Geburtstagseinträge geändert.", vbInformation, "Geburtstage angepasst "

Could you please translate this line for me? TIA
This comment was minimized by the moderator on the site
If possible, could you please give the above directive for auto-count in English??

This comment was minimized by the moderator on the site
Is there a way to set this up without using the birthday feature of the contact card?

On recurring could you set this up to show the number of years?
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations