PC Review


Reply
Thread Tools Rate Thread

Cannot Add Items to an Items Collection????

 
 
John Riddle
Guest
Posts: n/a
 
      6th Oct 2005
Hello,

I've got code in my VBA module that has been working great for me and all
users for over a year now and suddenly we are getting errors such as: Error
287 Application-defined or Object-defined Error.

Here is my code:

Sub CreateAppointment(ByVal propname)
Dim AppointmentFolder As MAPIFolder
Dim AppointmentItems As Items
Dim NewAppointment As AppointmentItem

On Error GoTo NoAppointment
Select Case propname
Case "Phone Interview"
strPhoneID = m_objTask.UserProperties("Phone EntryID")
strPhoneStoreID =
Application.Session.GetDefaultFolder(olFolderCalendar).StoreID
Set myAppointment = Application.Session.GetItemFromID(strPhoneID,
strPhoneStoreID)

Case "1st Interview"
str1stID = m_objTask.UserProperties("1st EntryID")
str1stStoreID =
Application.Session.GetDefaultFolder(olFolderCalendar).StoreID
Set myAppointment = Application.Session.GetItemFromID(str1stID,
str1stStoreID)

Case "2nd Interview"
str2ndID = m_objTask.UserProperties("2nd EntryID")
str2ndStoreID =
Application.Session.GetDefaultFolder(olFolderCalendar).StoreID
Set myAppointment = Application.Session.GetItemFromID(str2ndID,
str2ndStoreID)

Case "3rd Interview"
str3rdID = m_objTask.UserProperties("3rd EntryID")
str3rdStoreID =
Application.Session.GetDefaultFolder(olFolderCalendar).StoreID
Set myAppointment = Application.Session.GetItemFromID(str3rdID,
str3rdStoreID)

End Select

ChangeAppointment myAppointment, propname

Exit Sub

NoAppointment:
Set AppointmentFolder =
Application.Session.GetDefaultFolder(olFolderCalendar)
Set AppointmentItems = AppointmentFolder.Items
Set NewAppointment = AppointmentItems.Add()
PopulateAppointment NewAppointment, propname

End Sub

The Error occurs at the line:

Set NewAppointment = AppointmentItems.Add()

I've tried:

Set NewAppointment = AppointmentItems.Add(olAppointmentItem)

still no good. This has just started happening after working flawlessly for a
long time.

Any suggestions?

Thanks,

John


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Items collection doesn't contain all items escamoteur Microsoft Outlook VBA Programming 5 9th Sep 2009 10:31 PM
Items collection doesn't contain all items escamoteur Microsoft Outlook Program Addins 4 9th Sep 2009 10:31 PM
Items collection doesn't contain all items escamoteur Microsoft Outlook VBA Programming 1 9th Sep 2009 02:46 PM
Hidding collection items Mario Vázquez Microsoft Dot NET Framework 2 29th Dec 2006 09:55 AM
Delete duplicate items in sent items or how to sort by how many items in conversation view dangmoss Microsoft Outlook Discussion 2 2nd Feb 2006 02:59 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:43 AM.