Solved

VBA create an appointment but wait for user to confirm

Posted on 2008-10-01
5
476 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 125 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

810 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