Hi I apologise in advance but my last post got nowhere but probably due to the lack of my actual code.
I have barely managed to find some code that lets me use the data in a table to populate my own calendar in excel please see attached
The code works great for my own calendar but I require it to instead make appointments on a shared calendar located in
">All Public Folders>WorkForce>WFD>WFD Adults"
with WFD Adults being the calendar name
I am completely stumped everything I have tried has failed and I am in need of someone to save me
I have barely managed to find some code that lets me use the data in a table to populate my own calendar in excel please see attached
Code:
Sub Appointments()
Const olAppointmentItem As Long = 1
Dim oApp As Object
Dim OLNS As Object
Dim oAppt As Object
On Error Resume Next
Set oApp = GetObject(, "Outlook.Application")
If oApp Is Nothing Then Set oApp = CreateObject("Outlook.Application")
On Error GoTo 0
If Not oApp Is Nothing Then
Set OLNS = oApp.GetNamespace("MAPI")
OLNS.Logon
Set oAppt = oApp.CreateItem(olAppointmentItem)
oAppt.Subject = Range("A2").Value
oAppt.Start = Range("b2").Value
oAppt.Duration = Range("c2").Value
oAppt.Save
Set OLAppointment = Nothing
Set OLNS = Nothing
Set oApp = Nothing
End If
End Sub
The code works great for my own calendar but I require it to instead make appointments on a shared calendar located in
">All Public Folders>WorkForce>WFD>WFD Adults"
with WFD Adults being the calendar name
I am completely stumped everything I have tried has failed and I am in need of someone to save me