excel to Shared calendar appointments

Hello i am desperate need of some help!i have the following code that works for putting appointments into my own default calendar in outlook, however i require it to input to a shared calendar i have looked all over and found some code that i have turned into anotations but it always shows me an error when trying to dim outlook.folder and i cant figure out what im doing wrong


Sub Appointments()
 Const olAppointmentItem As Long = 1
 Dim oApp As Object

 Dim OLNS As Object
 Dim oAppt As Object
‘Dim oFolder As Outlook.Folder


 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”)

 Set oAppt = oApp.CreateItem(olAppointmentItem)
 oAppt.Subject = Range(“A2”).Value
 oAppt.Start = Range(“b2”).Value
 oAppt.Duration = Range(“c2”).Value

‘Set oFolder = oNamespace.GetDefaultFolder(olPublicFoldersAllPublicFolders)
‘Set oFolder = oFolder.Folders(“Workforce Admin”)
‘Set oFolder = oFolder.Folders(“WFD”)
‘Set oFolder = oFolder.Folders(“WFD Adults”)


 Set OLAppointment = Nothing
 Set OLNS = Nothing
 Set oApp = Nothing
 End If

 End Sub

By: Liam

Leave a Reply

Your email address will not be published. Required fields are marked *