Hello
I have the following vba code which creates an appointment in Outlook:
I would like the code to enter the appointment in a specific calendar. Calendar is called "Calendar from iCloud"
Very much appreciated
Sub Appointments()
Const olAppointmentItem As Long = 1
Dim OLApp As Object
Dim OLNS As Object
Dim OLAppointment As Object
On Error Resume Next
Set OLApp = GetObject(, "Outlook.Application")
If OLApp Is Nothing Then Set OLApp = CreateObject("Outlook.Application")
On Error GoTo 0
If Not OLApp Is Nothing Then
Set OLNS = OLApp.GetNamespace("MAPI")
OLNS.Logon
Set OLAppointment = OLApp.CreateItem(olAppointmentItem)
OLAppointment.Subject = cbet
OLAppointment.Start = tbBookingdate
OLAppointment.Duration = cbduration
OLAppointment.ReminderMinutesBeforeStart = 5
OLAppointment.Save
Set OLAppointment = Nothing
Set OLNS = Nothing
Set OLApp = Nothing
End If
End Sub
I have the following vba code which creates an appointment in Outlook:
I would like the code to enter the appointment in a specific calendar. Calendar is called "Calendar from iCloud"
Very much appreciated
Sub Appointments()
Const olAppointmentItem As Long = 1
Dim OLApp As Object
Dim OLNS As Object
Dim OLAppointment As Object
On Error Resume Next
Set OLApp = GetObject(, "Outlook.Application")
If OLApp Is Nothing Then Set OLApp = CreateObject("Outlook.Application")
On Error GoTo 0
If Not OLApp Is Nothing Then
Set OLNS = OLApp.GetNamespace("MAPI")
OLNS.Logon
Set OLAppointment = OLApp.CreateItem(olAppointmentItem)
OLAppointment.Subject = cbet
OLAppointment.Start = tbBookingdate
OLAppointment.Duration = cbduration
OLAppointment.ReminderMinutesBeforeStart = 5
OLAppointment.Save
Set OLAppointment = Nothing
Set OLNS = Nothing
Set OLApp = Nothing
End If
End Sub