How to Auto Mark All Evening Appointments as Private in Your Outlook

Generally, a majority of appointments scheduled in the evening are private. So, you may wish Outlook to auto mark all evening appointments as private. Now, this article will guide you to realize it step by step.

In order to differentiate the appointments related to your work from the private ones in Outlook, you can simply modify the correct appointments’ sensitivities to “private”. Under this circumstance, you will discover some rules. For example, the weekend and evening appointments are commonly private. In this situation, you must hope that Outlook is capable of recognizing the evening appointments and auto marking them as private. Even though there isn’t such a direct feature, it still can be achieved by a bit of scripting. In the followings, we will expose such a way in detail.

Auto Mark All Evening Appointments as Private

  1. At the very outset, launch Outlook VBA editor according to “How to Run VBA Code in Your Outlook“.
  2. Then, copy the following VBA code into “ThisOutlookSession” project.
Public WithEvents objInspectors As Outlook.Inspectors
Public WithEvents objExplorer As Outlook.Explorer
Public WithEvents objAppointment As Outlook.AppointmentItem

Private Sub Application_Startup()
    Set objInspectors = Outlook.Application.Inspectors
    Set objExplorer = Outlook.Application.ActiveExplorer
End Sub

Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
    If Inspector.CurrentItem.Class = olAppointment Then
       Set objAppointment = Inspector.CurrentItem
    End If
End Sub

Private Sub objExplorer_Activate()
    On Error Resume Next
    If objExplorer.Selection.Item(1).Class = olAppointment Then
       Set objAppointment = objExplorer.Selection.Item(1)
    End If
End Sub

Private Sub objAppointment_Open(Cancel As Boolean)
    Call MarkEveningAppointmentPrivate(objAppointment)
End Sub

Private Sub objAppointment_PropertyChange(ByVal Name As String)
    If Name = "Start" Or Name = "End" Then
       Call MarkEveningAppointmentPrivate(objAppointment)
    End If
End Sub

Private Sub MarkEveningAppointmentPrivate(ByVal objAppointment As Outlook.AppointmentItem)
    Dim dStartTime As Date
 
    dStartTime = Format(objAppointment.Start, "hh:mm")
 
    'Appointments scheduled in evening
    If dStartTime > "19:00" Then
       objAppointment.Sensitivity = olPrivate
    End If
End Sub

VBA Code - Auto Mark All Evening Appointments as Private

  1. Later, restart your Outlook to activate this macro.
  2. Since then, every time when you change an appointment’s start time to the evening, it will be auto modified to “private” status.Private Evening Appointments

Eradicate Annoying PST Troubles

Outlook PST file is susceptible to corruption. Therefore, you will surely encounter a variety of Outlook PST issues. For instance, if you open a great number of items, Outlook tends to be stuck and keep in “not responding”. Besides, if you download any malicious attachments, your Outlook data may be infected. All of such similar cases can damage your Outlook files. To restore corrupt Outlook data, you have to take recourse to a robust and reliable PST fix utility, such as DataNumen Outlook Repair.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupted sql and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.