Modify all calendar items to be Private using VBA

  • Thread starter Thread starter Michael Mahony
  • Start date Start date
M

Michael Mahony

I want to go through my Outlook calendar items and mark everything
private. Is there a simple way I can accomplish this using VBA? It
is just a one time thing. Once they are marked as private I'll
maintain the appointments in the proper context from that point
onward. I need to do this because I am implementing a new calendar
sharing system at the office and don't want all my personal
appointments open to the public. :-) Thanks.
 
Assuming there are only appointment items in the folder:

Sub MakeAllPrivate()
Dim oFolder As Outlook.MAPIFolder
Dim oItems As Outlook.Items
Dim oAppt As Outlook.AppointmentItem

On Error Resume Next

Set oFolder = Application.Session.GetDefaultFolder(olFolderCalendar)
Set oItems = oFolder.Items
For Each oAppt In oItems
If Err Then
Err.Clear
Else
oAppt.Sensitivity = olPrivate
oAppt.Save
End If
Next
End Sub
 
Hi Ken. i am new to vba and not a programmer.
Is there a way to reverse this code to make all appointments public please?
Thanks Gordon
 
Back
Top