VBA cannot send calendar schedule

When I manually create a calendar reminder / appointment, I can click "Invite participants" and select the invited people, and then click "Send", and everyone will receive a calendar reminder / appointment.

I have the following code to make a reminder programmatically, but it will not be sent to the intended recipients. If I open the reminder after running the script and click "Invite participants", I see that the list is filled with people on whom I want to send a reminder, so I'm not sure why it does not actually send a reminder to them.

Can anyone shed some light on this for me?

Private 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
    ' Only create the reminder if there no duplicate
    If (CheckForDuplicates(SubjectStr) = False) Then
        Set olApp = CreateObject("Outlook.Application")
        Set Appt = olApp.CreateItem(olAppointmentItem)
        Appt.Recipients.Add ("John Doe")
        Appt.Recipients.ResolveAll
        Appt.Subject = SubjectStr
        Appt.Start = StartTime
        Appt.End = EndTime
        Appt.AllDayEvent = AllDay
        Appt.Body = BodyStr
        Appt.ReminderSet = True
        Appt.Save
        Appt.Send
    End If
    Set Appt = Nothing
    Set olApp = Nothing
End Function
+5
source share
1

- - , .

, , . "". :

Appt.MeetingStatus = olMeeting

, , . ,

Appt.ReminderMinutesBeforeStart = 30

, Outlook VBA, CreateObject? Application Object .

.

Set olApp = CreateObject("Outlook.Application")

Set olApp = Outlook.Application

+4

All Articles