Microsoft Access Office VB VBA Help and Examples

Create Outlook Appointment from Access

The code below shows you what is required to create a basic appointment in outlook. Remember to add the reference for the version of Outlook you are using.

Public Function CreateAppointment(SubjectStr As String, BodyStr As String, StartTime As Date, EndTime As Date, AllDay As Boolean)
     Dim OlApp As Outlook.Application
     Dim Appt As Outlook.AppointmentItem
     Set OlApp = CreateObject("Outlook.Application")
     Set Appt = OlApp.CreateItem(olAppointmentItem)
     Appt.Subject = SubjectStr
     Appt.Start = StartTime
     Appt.End = EndTime
     Appt.AllDayEvent = AllDay
     Appt.BOdy = BodyStr
     Set Appt = Nothing
     Set OlApp = Nothing
End Function

Below is an example of how to call this function

Private Sub testsub()
     CreateAppointment "John Test", "This is the body", Now(), Now + 1, True
End Sub
The code and application content of this site is copyright of Smiley I.T. and as such reproduction in any form which is for commercial use requires the permission of the Webmaster. Any use of this code for non-commercial use only requires a link or comment back to the original page you took the code from.