Custom type not defined for AppointmentItem in Excel

I copied the example at http://support.microsoft.com/kb/220595 in VBA in Excel.

My code is:

Dim olApp As Outlook.Application Set olApp = CreateObject("Outlook.Application") Dim olAppt As Outlook.AppointmentItem Set olAppt = olApp.CreateItem(olAppointmentItem) 

I got the following error on the Dim olAppt As Outlook.AppointmentItem : "Custom type not defined."

How should this be fixed?

I am using MS Office 2003.

0
source share
2 answers

This article lists four prerequisites. They are listed right before the code block.

You probably forgot to follow step two, Adding a link to the Outlook object library .
The only difference is that in VBA the menu item is under Tools , not Project .

+1
source

You need to access all the constants by their value, since olAppointmentItem = 1:

  Set olAppt = olApp.CreateItem(1) 

You can search for values, for example http://msdn.microsoft.com/en-us/library/aa911356.aspx , or use the Outlook Object Browser to get the values.

0
source

All Articles