If you have a list of birthday information in an Excel worksheet, you may want to import these birthdays into your Outlook calendar as events. This article will guide you to accomplish it in quick time.
From the previous article – “How to Batch Import Birthdays from Excel to the Corresponding Outlook Contacts”, you can learn the means to add birthday info in an Excel to relevant contacts. Similar to that, some users would like to create Outlook birthday events from the data in an Excel sheet. Looking at this issue, we will expose another piece of VBA code to help you get it with ease.
Batch Import Birthdays from Excel to Outlook Calendar
- Frist of all, open the specific Excel file. My sample Excel file is as shown in the following figure.
- Then, press “Alt + F11” to trigger Excel VBA editor.
- Next, in the new “Microsoft Visual Basic for Applications” window, enable the reference to “MS Outlook Object Library” according to “How to Add an Object Library Reference in VBA“.
- After that, copy the following VBA code into a project or module.
Sub ImportBirthdaysToCalendar() Dim objWorksheet As Excel.Worksheet Dim nLastRow As Integer Dim objOutlookApp As Outlook.Application Dim objCalendar As Outlook.Folder Dim objBirthdayEvent As Outlook.AppointmentItem Dim objRecurrencePattern As Outlook.RecurrencePattern 'Get the specific sheet Set objWorksheet = ThisWorkbook.Sheets(1) nLastRow = objWorksheet.Range("A" & objWorksheet.Rows.Count).End(xlUp).Row Set objOutlookApp = CreateObject("Outlook.Application") Set objCalendar = objOutlookApp.Session.GetDefaultFolder(olFolderCalendar) For nRow = 2 To nLastRow Set objBirthdayEvent = objCalendar.Items.Add("IPM.Appointment") 'Create birthday events With objBirthdayEvent .Subject = objWorksheet.Range("A" & nRow) & Chr(39) & "s Birthday" .AllDayEvent = True .Start = objWorksheet.Range("B" & nRow) Set objRecurrencePattern = .GetRecurrencePattern objRecurrencePattern.RecurrenceType = olRecursYearly .Save End With Next End Sub
Note: 1. Change the specific sheet as per your case.
- Change the corresponding cell range depending on your own Excel file.
- Finally, directly press “F5” key to run this macro.
- When macro finishes, you can open your Outlook default calendar folder, in which you can see all the new imported birthday events, like the screenshot below.
Vulnerable Outlook PST Files
Like Word documents and Excel workbooks, virtually, Outlook PST files are same vulnerable. For years, many users have been ever subject to Outlook file damage. In that situation, they have to attempt knotty PST repair. Yet, commonly, built-in fix tool – Scanpst is always unable to accomplish it. Hence, in this course, a more specialized and top-ranking external tool is highly required, such as DataNumen Outlook Repair, which can help you extract maximum data from corrupt PST file.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupt sql and outlook repair software products. For more information visit www.datanumen.com
Leave a Reply