Clear Birthday From All Outlook Contacts


This post is for Rakesh (aaR4 on Twitter).  Rakesh tweeted the following request to me tonight

Outlook does not have a built-in means of doing this, but it is possible with a script.  In this case I’m using VBScript instead of VBA since this is likely a one-time action.  Using VBScript saves Rakesh the trouble of adding the code to Outlook and removing it afterward.  

Instructions.

  1. Open Notepad.
  2. Copy the script and paste it into Notepad.
  3. Save the file with a .vbs extension.
  4. Close Notepad.
  5. Double-click the file saved in step #3. The script will go through all the contacts in the default contacts folder clearing the birthday field.
Const olFolderContacts = 10
Const olContact = 40

Dim olkApp, olkSes, olkFld, olkItm

Set olkApp = CreateObject("Outlook.Application")
Set olkSes = olkApp.GetNamespace("MAPI")
olkSes.Logon olkApp.DefaultProfileName

Set olkFld = olkSes.GetDefaultFolder(olFolderContacts)
For Each olkItm In olkFld.Items
    If olkItm.Class = olContact Then
        olkItm.Birthday = #1/1/4501#
        olkItm.Save
    End If
Next

Set olkItm = Nothing
Set olkFld = Nothing
olkSes.Logoff
Set olkSes = Nothing
Set olkApp = Nothing

MsgBox "Birthdays have been removed"
Advertisements

6 comments on “Clear Birthday From All Outlook Contacts

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s