Modify all calendar items to be Private using VBA


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.
 
Ad

Advertisements

K

Ken Slovak - [MVP - Outlook]

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
 
Ad

Advertisements

Joined
May 3, 2015
Messages
2
Reaction score
0
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top