Hi all,
I found several sources on the web on this topic and while my code doesn't generate any error, it doesn't send the invitation out (tried it on my email).
Public Sub CreateAppointment(ByVal Code As String, ByVal Start As Date, ByVal Length As Long, ByVal Receipent As String)
Dim oApp As Outlook.Application
Dim oNameSpace As Namespace
Dim oItem As AppointmentItem
On Error Resume Next
' check if Outlook is running
Set oApp = GetObject("Outlook.Application")
If Err <> 0 Then
'if not running, start it
Set oApp = CreateObject("Outlook.Application")
End If
Set oItem = oApp.CreateItem(olAppointmentItem)
With oItem
.RequiredAttendees = Receipent
.Subject = Code
.Start = Start
.Duration = Length
.AllDayEvent = False
.Importance = olImportanceNormal
.ReminderSet = True
.ReminderMinutesBeforeStart = "10"
.Send
End With
Set oApp = Nothing
Set oItem = Nothing
End Sub
It doesn't save the appointment in saved either (when .save is added that is).
Thanks!
Bookmarks