I have been searching for several days now for code that will add an appointment to a public calendar on our exchange network using vba code. Here is what I've found:
Dim olApp As New Outlook.Application
Dim olNameSpace As Outlook.NameSpace
Dim olPublicFolder As Outlook.MAPIFolder
Dim olAppt As Outlook.AppointmentItem
Set olApp = CreateObject("Outlook.Application")
Set olNameSpace = olApp.GetNamespace("MAPI")
Set olPublicFolder = olNameSpace.Folders("Public Folders/All Public Folders/Sub-folder/Sub-folder/Sub-folder/Sub-folder/Actual Calendar File")
Set olAppt = olApp.CreateItem(olAppointmentItem)
With olAppt
.Subject = "TEST SUBJECT"
.Body = "TEST BODY"
.LOCATION = "TEST LOCATION"
.Move olPublicFolder
End With ' olAppt
olAppt.Save
This appears to be close to working, but gives me an error message saying that it can't find the file. Debugging highlights the "Set olPublicFolder" line. Is there something wrong with the code, or maybe is there a better way to accomplish this? I'm in the military, so I've changed the folder path listed above for security reasons.