add new atendee to an existing appointment

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
 
K

Ken Slovak - [MVP - Outlook]

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.
 
A

Andrew

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
 
K

Ken Slovak - [MVP - Outlook]

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
 

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