Hello I am in desperate need of some help! please take a look at 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 the Dim outlook.folder but I keep getting compile error I know the code below isn't clean but any help would be greatly appreciated
if this helps the shared calendar is in "all public folders/workforce admin/WFD/WFD Adults"
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”)
OLNS.Logon
‘Set oFolder = oNamespace.GetDefaultFolder(olPublicFoldersAllPublicFolders)
‘Set oFolder = oFolder.Folders(“Workforce Admin”)
‘Set oFolder = oFolder.Folders(“WFD”)
‘Set oFolder = oFolder.Folders(“WFD Adults”)
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
Bookmarks