add new atendee to an existing appointment

  • Thread starter Thread starter Andrew
  • Start date Start date
A

Andrew

Hi all.

I am stuck. In my enviroment we have a public calendar with heaps of
professional events. i am trying to create a VBA code linked to a button that
once pressed it would add the user that pressed it to the list of required
attendees to the existing event.

Can any one help me

Thank you

Andrew
 
Get the calendar appointment from
Application.ActiveExplorer.Selection.Item(1). Get its Recipients collection,
get NameSpace.CurrentUser.Address. Add that to the Recipients collection
using the Recipients.Add method. Specify the Recipient.Type as olTo, which
means required recipient.
 
Hi Ken

Unfortuanly i am very limited in my understanding of the VBA Scripting could
you please show me te example of what you mean.

Thank you for your time

Andrew
 
There's no error handling in this and it's just a basic example that assumes
that whatever is selected is actually an appointment item. The code also
assumes it's running in the Outlook VBA project.

Sub AddRecip()
Dim oAppt As Outlook.AppointmentItem
Dim colRecips as Outlook.Recipients
Dim oRecip As Outlook.Recipient

Set oAppt = Application.ActiveExplorer.Selection.Item(1)
Set colRecips = oAppt.Recipients
Set oRecip = colRecips.Add(Application.Session.CurrentUser.Address)
oRecip.Type = olTo

oAppt.Save

Set oRecip = Nothing
Set colRecips = Nothing
Set oAppt = Nothing
End Sub
 
Back
Top