Last reviewed on November 25, 2013   —  No Comments

Applies to Microsoft Outlook 2013, Outlook 2010, Outlook 2007 and older

Set working hours in Outlook's Calendar OptionsOutlook has an option for the start and end of the user's work day.

Unfortunately, it's mostly for show in the calendar because Outlook doesn't include working hours in Free/Busy or warn you if you're making an appointment outside of your normal working hours.

Is there a way to pop up a warning when a meeting is scheduled at incorrect times, say before 8 AM or after 7 PM?

You can use a VBA macro to watch the calendar for new appointments and ask if you want keep the appointment when the start time is too early or the appointment ends after a certain time.

Warning when the start or end time is outside certain hours.Click Yes to leave the appointment on your calendar, click No to open the appointment so you can edit the time or delete it.

Check start and end times

This is an Application_Startup macro and needs to go in ThisOutlookSession. Click on the Application_Startup macro and click Run to test it without restarting Outlook.

Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
  Dim Ns As Outlook.NameSpace
  Set Ns = Application.GetNamespace("MAPI")
  Set Items = Ns.GetDefaultFolder(olFolderCalendar).Items
End Sub

Private Sub Items_ItemAdd(ByVal Item As Object)
  On Error Resume Next

' change the start and end times as needed
If TimeValue(Item.Start) < TimeValue("7:59:00 AM") Or _
    TimeValue(Item.End) > TimeValue("7:00:00 PM") Then
    strMsg = "This appointment is scheduled to start at " & _
    vbCrLf & TimeValue(Item.Start) & " and end at " & _
    TimeValue(Item.End) & vbCrLf & _
    "Do you still want to schedule it?"
    intRes = MsgBox(strMsg, vbYesNo + vbExclamation, "Confirm Appointment Hours")
' If you say no, the opens for you to change the times or delete it.
    If intRes = vbNo Then
    End If
End If
End Sub

How to use this macro

First: You will need macro security set to low during testing.

To check your macro security in Outlook 2010 or 2013, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security.

After you test the macro and see that it works, you can either leave macro security set to low or sign the macro.

Open the VBA Editor by pressing Alt+F11 on your keyboard.

To use the macro code in ThisOutlookSession:

  1. Expand Project1 and double click on ThisOutlookSession.
  2. Copy then paste the macro into ThisOutlookSession. (Click within the code, Select All using Ctrl+A, Ctrl+C to copy, Ctrl+V to paste.)

More information as well as screenshots are at How to use the VBA Editor

Leave a Reply

Please post long or more complicated questions at OutlookForums by

If the Post Comment button disappears, press your Tab key.