Over the years, I've had a lot of questions from users who wanted to filter their birthday events. This article shows how to Create a custom view to list upcoming birthdays.
But what about sorting by month and day, as they will appear on the calendar?
For example, a contact's birthday is 11/18/1935. It shows up on the correct 2014 date in month/week/day view, but in the list view, it appears at the top of the list, because Outlook sorts by the serial value of the date when using a numerical date format. It won't appear at all if you filter for 2014 start dates, because the year is 1935.
If you want to see a list containing only birthdays, you need to filter for recurrence equals yearly, not the Start date. If you have a lot of yearly events on your calendar, assign a category to your birthday events and filter on that as well.
To create this filter, switch to a List view (on the View tab).
- Click the View Settings button, then Filter, and Advanced tab.
- Click on Field and select Recurrence from the Frequently used fields list or type recurrence in the box beneath Field.
- Select equals as the Condition
- Select Yearly as the Value.
- Click Add to List then Ok twice to exit the dialog and apply the filter.
This filter won't help with sorting, because you can't sort by the recurrence pattern as that field sorts alphabetically.
The solution: use a macro to add a custom number field to the birthday events then add the custom field to the view and sort by it. By using a decimal format for the month and day, the events will be in chronological order for the current year.
To add the field to the view in Outlook 2013 or Outlook 2010
- Click View Settings then Columns (or Fields in older versions of Outlook).
- Select User-defined fields in folder from the
- Select available columns from dropdown
- Select the newly created field and click Add ->.
- Click Ok twice to exit the dialog and return to Outlook.
The macro and custom views will work with all versions of Outlook.
Sort by Birthday macro
Select the birthdays (or any recurring events) and run the macro to add a field to each event that contains the start date as a number in decimal format. You'll need to run this on new birthday events after they are added or before you want to sort but birthday.
Public Sub SortBirthdayMonthDay() Dim currentExplorer As Explorer Dim Selection As Selection Dim obj As Object Dim objProp As Outlook.UserProperty Dim strMonth Set currentExplorer = Application.ActiveExplorer Set Selection = currentExplorer.Selection On Error Resume Next For Each obj In Selection Set objAppt = obj strMonth = Month(objAppt.Start) & "." & Day(objAppt.Start) Set objProp = objAppt.UserProperties.Add("Birth Month.Day", olNumber, True) objProp.value = strMonth objAppt.Save Err.Clear Next Set currentExplorer = Nothing Set obj = Nothing Set Selection = Nothing End Sub
How to use macros
First: You will need macro security set to low during testing.
To check your macro security in Outlook 2010 or 2013, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security.
After you test the macro and see that it works, you can either leave macro security set to low or sign the macro.
Open the VBA Editor by pressing Alt+F11 on your keyboard.
To put the code in a module:
- Right click on Project1 and choose Insert > Module
- Copy and paste the macro into the new module.
More information as well as screenshots are at How to use the VBA Editor