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
Appt.Save
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 |
|