• Skip to main content
  • Skip to primary sidebar

Ryan McCormick

Set Appointment in Outlook With VBA in Access or Excel 2010, 2013

March 26, 2014 by Ryan 6 Comments

When writing automation for certain processes, it is sometimes important to set a follow-up reminder appointment for the next step. For this task, I wrote a very simple script that sets a reminder in Outlook.

This script is super simple and can be improved several different ways. For simplicity sake, I decided to leave out the fancy “With” procedure and just use the object reference. Also, to provide feedback to your app, this function evaluates to “true” once your reminder has been set.

'Before using this function, you must add a reference
'to your version of the Microsoft Outlook Object
'Library or you will encounter errors.
''''''''''''''''''''''''''''''''''''
Function makeReminder(rDate As Date) As Boolean
    Dim ol As Outlook.Application, item As AppointmentItem
    
    Set ol = New Outlook.Application
    Set item = ol.CreateItem(olAppointmentItem)
    	
	'Set the reminder for 8:30 am on input date
    item.Start = rDate + TimeValue("8:30")
    'Set one hour duration
    item.Duration = 60
    'appointment subject
    item.Subject = "Write your fancy subject line here"
    'location description
    item.Location = "Somewhere over there"
    'body message
    item.Body = "What in the world are you doing at this time?"
    'set the busy status
    item.BusyStatus = olBusy
    'reminder before start
    item.ReminderMinutesBeforeStart = 15
    'reminder activated
    item.ReminderSet = True
    'duh! save the thing!
    item.Save
    
    'garbage collection - kind of...
    Set ol = Nothing
    Set item = Nothing
    
    'return true
    makeReminder = True       
	
End Function

Test Outlook Appointment VBA Script

To test this script, here is an example:

Sub testThing()
Dim rDate As Date
	'set date
	rDate = InputBox("start")

	If makeReminder(rDate) = True Then
		MsgBox "Reminder Set"
	Else
		MsgBox "Oy! Something is a miss"
	End If

End Sub

So there it is! My obviously simple Outlook Appointment setting function. That being said, this demo was created to be a simple framework for what the object can do. If you use this, please post a comment about how you used it and any extra features you used.

Filed Under: VBA Tagged With: access, Excel, outlook appointment, vba

Reader Interactions

Comments

  1. Michael says

    March 25, 2015 at 2:47 pm

    Works perfectly. Thanks so much for posting this. I have been trying to sort this out for days now. I am using to this code to schedule project tasks based off a known start date. So from the one date I calculate 7 different task due dates and inserts them in to my calendar with one click. Saves me tons of time.

    Reply
  2. Edson says

    January 6, 2017 at 8:07 pm

    Hello, I have a problem using this script. When a compile the VBA project, the program shows me a message box with this information: “Compilation Error: The type defined by the user it hasn’t been defined”, do you know what is solution for this?

    Reply
    • Ryan McCormick says

      March 19, 2017 at 4:02 pm

      Sounds like you are missing a reference to the MS Outlook library. Check your references.

      Reply
  3. John says

    April 3, 2017 at 10:45 am

    Yes, thank you! So many of these just don’t work and it’s frustrating to those trying to learn. Even the one on Microsoft’s site doesn’t work as they use application.createItem which is incorrect. Thanks again!

    Reply
  4. Frank says

    May 30, 2017 at 4:55 am

    Hey,

    Thanks for this code it helps me a lot but i’m still working on something. I want to add people to the appointment. The appointments i want to make are not for me alone. So i added the next line:

    item.RequiredAttendees = “fake@emailadress.com”
    item.send

    But it add the person to the appointment but it doen’st send a invite. How can i build this in?

    Reply
  5. Guy Incognito says

    November 2, 2017 at 10:03 am

    You’ll need to set the meeting status to get the message to set automatically.

    item.MeetingStatus = olMeeting

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Recent Posts

  • Force Quit Kill all Chrome Windows MacOS
  • SOLVED: Angular 6 CLI Karma Stuck in Single Run | Karma Stops Running
  • How to Manually Install Java 8 on Ubuntu 18.04 LTS
  • Remove VirtualBox from Ubuntu 16.04 Xenial
  • Clear all Node Modules Folders Recursively Mac/Linux

Recent Comments

  1. KKV on Webstorm adding spaces between imports and braces | JavaScript and TypeScript
  2. jusopi on Clear all Node Modules Folders Recursively Mac/Linux
  3. Qaisar Irfan on Clear all Node Modules Folders Recursively Mac/Linux
  4. mustafa on Remove VirtualBox from Ubuntu 16.04 Xenial
  5. Pourya on How to Manually Install Java 8 on Ubuntu 18.04 LTS

Copyright © 2025 · Magazine Pro on Genesis Framework · WordPress · Log in