If you have an excel file which contains the information of many contacts, including their birthdays, and you want to import the birthdays to corresponding contacts in your Outlook, you can use the method introduced in this article.
Perhaps you have an Excel worksheet which is recording the information of many of your colleagues, including their respective birthdays. Therefore, now, you wish to quickly add these birthdays to the corresponding Outlook contacts. If there are no according existing contacts, directly create them. In response to this need, it is suggested to use Outlook VBA to achieve it. Read on to get the detailed steps and VBA codes.
Batch Import Birthdays from Excel to the Corresponding Contacts
The following screenshot is showing my Excel worksheet. My VBA codes will be written based on the rows and columns.
- In the first place, launch your Outlook application.
- Then press “Alt + F11” key shortcuts to access VBA editor.
- Next you can open a not-in-use module or simply insert a new module.
- Subsequently, copy the following VBA codes into the module. Note that you should change some values based on your own actual case.
Sub ImportBirthdaysfromExceltoOutlook() Dim strExcelFile As String Dim objExcelApp As Excel.Application Dim objExcelWorkBook As Excel.Workbook Dim objExcelWorkSheet As Excel.Worksheet Dim nRow As Integer Dim nColumn As Integer Dim objContactsFolder As Outlook.Folder Dim strContactFullName As String Dim objContact As Outlook.ContactItem 'Specify the Excel file which you want to import from strExcelFile = "E:\Contacts\Colleague Birthdays.xlsx" 'Get Access to the Excel file On Error Resume Next Set objExcelApp = CreateObject("Excel.Application") Set objExcelWorkBook = objExcelApp.Workbooks.Open(strExcelFile) Set objExcelWorkSheet = objExcelWorkBook.Sheets("Sheet1") Set objContactsFolder = Outlook.Application.Session.GetDefaultFolder(olFolderContacts) nRow = 2 nColumn = 1 While objExcelWorkSheet.Cells(nRow, 1) <> "" strContactFullName = objExcelWorkSheet.Cells(nRow, 1) Set objContact = objContactsFolder.Items.Find("[FullName] = '" & strContactFullName & "'") If objContact Is Nothing Then Set objContact = Application.CreateItem(olContactItem) With objContact .FullName = objExcelWorkSheet.Cells(nRow, 1) .Email1Address = objExcelWorkSheet.Cells(nRow, 2) .Birthday = objExcelWorkSheet.Cells(nRow, 3) .Save End With Else objContact.Birthday = objExcelWorkSheet.Cells(nRow, 3) objContact.Save End If nRow = nRow + 1 Wend Excel.Application.Workbooks.Close objExcelApp.Quit End Sub
- After that, you need to change your Outlook macro security level to low.
- Later go back to the module and hit the “Run” icon in the toolbar.
- Eventually, the macro will be triggered and the birthdays will be added to the according contacts at once.
Deal with Troublesome Outlook Problems Tactfully
There is no denying that Outlook is error prone. Thus, it is a tedious and arduous task to prevent Outlook damage. Hence, one of the most important precautions is to make regular data backups, which will be a lot of help in the event of your PST file getting corrupted. Moreover, you had better keep a robust fix tool nearby, like DataNumen Outlook Repair, which will provide you with immediate rescue.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including SQL Server damage and outlook repair software products. For more information visit www.datanumen.com