Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VBA create an appointment but wait for user to confirm

Posted on 2008-10-01
5
Medium Priority
?
490 Views
Last Modified: 2013-12-26
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
0
Comment
Question by:gbergsma
  • 3
  • 2
5 Comments
 
LVL 17

Expert Comment

by:wobbled
ID: 22612697
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.
0
 

Author Comment

by:gbergsma
ID: 22612734
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
0
 
LVL 17

Accepted Solution

by:
wobbled earned 500 total points
ID: 22612769
OK - I don't have outlook installed on my PC but can you not just add the line .display = true

With olAppt
      .Duration = 60
      .Subject = "Meeting to discuss plans..."
      .Body = "Meeting with " & olItem.FullName & " to discuss plans."
      .Location = "Home Office"
      .ReminderMinutesBeforeStart = 1
      .ReminderSet = True
      .Display = True
   End With
   
0
 

Author Closing Comment

by:gbergsma
ID: 31501892
.Display did it (without the "= True"
0
 
LVL 17

Expert Comment

by:wobbled
ID: 22613545
Great glad to have helped
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question