Problem with automatically sending Outlook appointment in VB

K

Kamyk

Hello all!

I have created a function in VB which generate appointment in Outlook.
Everything is OK, except one thing. I cannot send it automatically using a
button in Access, because I don`t know what is the code to send it
automatically. I noticed that if I click on Calendar>"click on selected
appointment">menu>Appointment>Invite Atendees everything is going well and
this appointment is sent to attendees given on the list.
My question is - what is the visual basic code of Invite atendees operation
given in Outlook???

Unfortunately this code below isn`t working as I would like it to work:

Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olFolder As Outlook.MAPIFolder
Dim olItems As Outlook.Items
Dim olAppt As Outlook.AppointmentItem

Set olApp = New Outlook.Application
Set olNS = olApp.GetNamespace("MAPI")
Set olFolder = olNS.GetDefaultFolder(olFolderCalendar)
Set olItems = olFolder.Items
Set olAppt = olItems.Add
With olAppt
.Start = "09-01-04 8:30 AM"
.End = "09-01-04 9:30 AM"
.Subject = "hi there"
.ReminderMinutesBeforeStart = "15"
.SAVE
.SEND
End With

Operation .SAVE and .SEND don`t send this appointments to atendees.

Thank you in advance
Marcin from Poland
 
C

captain747480

Hi

I haven't got Outlook on my PC so this is untested but I think you need to
add some Recipients to start with like this:-

With olAppt
.Start = "09-01-04 8:30 AM"
.End = "09-01-04 9:30 AM"
.Subject = "hi there"
.Recipients.Add "(e-mail address removed)"
.Recipients.Add "(e-mail address removed)"
.ReminderMinutesBeforeStart = "15"
.send
.save
End With

You could obviously create a loop to add the names from a list or table in
your Access Application programatically.

As I said I haven't been able to test this but I believe it's a step in the
right direction.

HTH

Andy W
 
K

Kamyk

I know what it was. I had to change appointment into meeting.
Here is the code

'CHANGE APPOINMENT ITEM TO A MEETING
objAppt.MeetingStatus = Outlook.OlMeetingStatus.olMeeting

When I added everything went ok.

Marcin
 

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