Add Birthday

This macro adds the birthdays of your contacts to the calendar.

Last modified: 2018/01/22 | Accessed: 33.654  | #168
◀ Previous sample Next sample ▶
ReplyAll ReplyAll
ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the e-mail.

If you create a new contact with a birthday, Outlook automatically adds a recurring appointment for the birthday to your calendar. If these birthdays disappear for any reason, you´d have to manually re-add all the birthdays. This macro does all the work and adds the birthdays of a to be selected contact folder to the calendar.

tip  How to add macros to Outlook
Public Sub AddBirthdays()
  Dim Folder As Outlook.MAPIFolder
  Dim Items As Outlook.Items
  Dim obj As Object
  Dim Contact As Outlook.ContactItem
  Dim BDay As Date

  Set Folder = Application.Session.PickFolder
  If Folder Is Nothing Then Exit Sub
  If Folder.DefaultItemType = olContactItem Then
  Dim i As Integer
    Set Items = Folder.Items
    For Each obj In Items
      If TypeOf obj Is Outlook.ContactItem Then
        Set Contact = obj
        BDay = Contact.Birthday
        If Year(BDay) > 0 And Year(BDay) < 4000 Then
          Contact.Birthday = 0
          Contact.Birthday = BDay
        End If
      End If
  End If
  MsgBox "done"
End Sub
OLKeeper OLKeeper
OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or e-mails.
email  Send a message