Macro to add calendar items from "birthday" field of imported cont

P

Peter K.

Hello,
When you add a contact with a birthday, a calendar item will be
automatically added. This doesn't work for imported contacts. And I don't
want to manually re-enter the birthday for the tens of contacts with
birthday. Apparently (after some googling) this functionality doesn't exist
in Outlook 2002, and it should be done with a macro.

I found the following macro on a German site (see other post in this
discussion group), but I am not very confident that it will not screw up all
my contacts (the "mybirthday" and the "12.12.2000" make it seem to me that it
might replace all my carefully collected birthdays with the birthday of this
joker? But maybe I'm just too paranoiac and this works just fine). I don't
know anything from macro's, so can someone have a look and check this macro?

Thanks a lot.

Peter

--------------------------------------------------------------------------------

Sub BirthdayImport()

Dim myFolder As MAPIFolder
Set myFolder = Session.PickFolder
For i = myFolder.Items.Count To 1 Step -1
If myFolder.Items(i).Class = 40 Then
myFolder.Items(i).Display
mybirthday = myFolder.Items(i).Birthday
myFolder.Items(i).Birthday = "12.12.2000 "
myFolder.Items(i).Birthday = mybirthday
myFolder.Items(i).Save
myFolder.Items(i).Close 0
End If
Next i

End Sub

--------------------------------------------------------------------------------
 
P

Peter K.

Ok, I try to get some learning out of this as well. I understand most of the
code now, so I understand that the 12.12.2000 is just a temporary birthday
date before being changed with the original one again.
The only line of code that I can't figure out is this one:

If myFolder.Items(i).Class = 40

What is the meaning of this 40 ?

Peter
 
K

Ken Slovak - [MVP - Outlook]

The Object Browser is your friend.

Class uses the OlObjectClass enum. 40 = olContact. So the code is testing to
see if the item is a contact item.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top