Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to attach Appointment to Shared Outlook Calendar

Status
Not open for further replies.

davidmo

Technical User
Apr 8, 2003
97
US
Hey everyone:
I've read a few threads on doing this but my code still won't work. Trying to attach an appointment to a shared outlook calendar.

Here is the code:
Private Sub cmdAddAppt_Click()
Dim myOlApp As Outlook.Application
Dim objAppt As Object
Dim myNamespace As Outlook.Namespace
Dim HisCalendar As Outlook.MAPIFolder

Set myOlApp = CreateObject("Outlook.Application")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set myRecipient = myNamespace.CreateRecipient("XYZ")
myRecipient.Resolve

Set HisCalendar = myNamespace.GetSharedDefaultFolder(myRecipient, olFolderCalendar)
Set objAppt = myOlApp.CreateItem(olAppointmentItem)

With objAppt
.Start = Me.Loan_Closing_Date
.Duration = 60
.Subject = Me.Meeting
.Move HisCalendar
.Save
.Close (olSave)
End With

Set objAppt = Nothing
Set HisCalendar = Nothing
Set myRecipient = Nothing
Set Namespace = Nothing
Set objOutlook = Nothing

End Sub

Seem to have a problem at "Set HisCalendar" part, doesn't recognize names.

Any thoughts?
Thanks

David
 
Figured a way around the problem. For the shared calendar needed to make the permissions for the users to be "owner". not sure if this is the best way but it solved the problem for now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top