Link to home
Start Free TrialLog in
Avatar of gbergsma
gbergsma

asked on

VBA create an appointment but wait for user to confirm

i,

I am using the following code from the MC website to create an appointment from VBA under Excel:

 ' Create a new appointment.
   Dim olAppt As Outlook.AppointmentItem
   Set olAppt = olApp.CreateItem(olAppointmentItem)
   
 ' Set start time for 2-minutes from now...
   olAppt.Start = Now() + (2# / 24# / 60#)
   
 ' Setup other appointment information...
   With olAppt
      .Duration = 60
      .Subject = "Meeting to discuss plans..."
      .Body = "Meeting with " & olItem.FullName & " to discuss plans."
      .Location = "Home Office"
      .ReminderMinutesBeforeStart = 1
      .ReminderSet = True
   End With
   
 ' Save Appointment...
   olAppt.Save

It all works fine. However, it would be really handy if I could create the appointment and display it to the user - who would then confirm the save, and make changes to the appointment if required.

Is there a way to do this?

Cheers

Bergsy
Avatar of wobbled
wobbled
Flag of United Kingdom of Great Britain and Northern Ireland image

There are two ways you can do this.  You can create the appointment as you do and then follow it with do you wish to confirm Yes / No.  If they click No you would then have to delete the appointment.  This is not a very good approach as you are creating the appointment then deleting it.

What I would recommend is that you just populate a userform etc with the information regarding the appointment.  Only then if they click Yes do you actually call your code above and create the appointment.
Avatar of gbergsma
gbergsma

ASKER

Unfortunately that doesnt give me the function I am looking for. I would like the user toi be able to interact with the Outlook appointment and make any changes (invite others, recurrence and so on) rather than having to build all of that with my own forms
ASKER CERTIFIED SOLUTION
Avatar of wobbled
wobbled
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
.Display did it (without the "= True"
Great glad to have helped