AppointmentItem question (2003)

D

Dana DeLouis

Hello. I'm studying Outlook Programming for the first time (Sue Mosher's
book). I was able to add an Appointment to the calender the other day, but
now it's not working.
Can anyone spot the why I'm getting an "'Application-defined" error. I'm
running this from Excel, with a vba library reference set to Outlook 11.
Outlook 2003, IM only mode also.
Thanks for any insight. I just don't see why it's not working now. :>(

Sub Testing()
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Dim objAppt As Outlook.AppointmentItem

Set olApp = Outlook.Application

'Application-defined or object-defined error
Set objAppt = olApp.CreateItem(olAppointmentItem)

'However, this is ok...
Set objMail = olApp.CreateItem(olMailItem)
End Sub
 
D

Dana DeLouis

Well, I think I found the problem. I just tried to add an new appointment
manually, and could not. I couldn't add an appointment, or modify any
appointments in my Calendar. Ahhh!
Some of the code must have corrupted the calendar.
Anyway, I rebooted the computer, and the sample code below works as
expected.
Something in my program must be corrupting the Calendar.
Anyway, thanks again.
 

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