Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   AppointmentItem question (2003) (http://www.outlookbanter.com/outlook-vba/7272-appointmentitem-question-2003-a.html)

Dana DeLouis January 18th 06 04:38 PM

AppointmentItem question (2003)
 
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

--
Dana



Dana DeLouis January 18th 06 05:13 PM

AppointmentItem question (2003)
 
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.

--
Dana
Win XP & Office 2003


"Dana DeLouis" wrote in message
...
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

--
Dana






All times are GMT +1. The time now is 11:00 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com