How to Get a Warning If the Received Meeting Is Scheduled Outside Your Work Hours

This article will teach you how to make Outlook to automatically prompt you if the scheduled time of a received meeting, namely its start and end time, is not inside your common work hours.

You may have ever received meeting invitations in your Outlook. In that case, you will need to check the meeting time and location and consider if you’re free at the scheduled time, and lastly send a response to the meeting organizer. At times, you may receive the meetings scheduled outside your usual work hours. In such situations, you have to consider carefully whether to accept such meetings or just declined. In order to prevent you from bypassing the meeting time, you can make Outlook to auto check it and warn you if the time isn’t inside your work hours via VBA. Here are the detailed steps and concrete VBA codes to achieve it.

Get a Warning If the Received Meeting Is Scheduled Outside Your Work Hours

Get a Warning If the Received Meeting Is Scheduled Outside Your Work Hours

  1. At the very outset, launch your Outlook program.
  2. Then press “Alt + F11” key buttons to access Outlook VBA editor.
  3. Next, in the new window, double click the “ThisOutlookSession” on the left side to open this project.
  4. Subsequently, copy and paste the following codes into this project.
Private WithEvents objItems As Outlook.Items
Private Sub Application_Startup()
    Set objItems = Outlook.Application.Session.GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub objItems_ItemAdd(ByVal Item As Object)
    Dim objMeetingRequest As MeetingItem
    Dim objMeeting As AppointmentItem
    Dim objMeetingResponse As MeetingItem
    Dim dStart As Date
    Dim dEnd As Date
    Dim nPrompt As Integer
    Dim strMsg As String
    Dim nResponse As Integer
    If TypeOf Item Is MeetingItem Then
       Set objMeetingRequest = Item
       Set objMeeting = objMeetingRequest.GetAssociatedAppointment(True)
       dStart = objMeeting.Start
       dEnd = objMeeting.End
       'Check the start time and end time of the received meeting
       If TimeValue(dStart) < TimeValue("7:59:00 AM") Or TimeValue(dEnd) > TimeValue("7:00:00 PM") Then
          'Ask if to accept the meeting scheduled out of your work hours
          strMsg = "You recieve a new meeting, scheduled to start at " & TimeValue(dStart) & " and end at " & TimeValue(dEnd) & " , which is out of your normal work hours. Do you accept it?"
          nResponse = MsgBox(strMsg, vbQuestion + vbYesNo, "Check Meeting Hours")
          'If click "Yes", send an accepted response
          If nResponse = vbYes Then
             Set objMeetingResponse = objMeeting.Respond(olMeetingAccepted)
             'If click "No", send an declined response
             Set objMeetingResponse = objMeeting.Respond(olMeetingDeclined)
          End If
       End If
    End If
End Sub

VBA Codes - Get a Warning If the Received Meeting Is Scheduled Outside Your Work Hours

  1. After that, you need to sign this code.
  2. Later change your macro settings to permit the digitally signed macros.
  3. Finally you can restart Outlook to activate the new VBA project.

From now on, Outlook will automatically check the scheduled time of received meetings and prompt you according to the following rules.

  1. If the received meeting is scheduled inside work hours, nothing will happen.
  2. If the received meeting is scheduled outside work hours, a prompt will pop up, like the following image.Prompt If the Received Meeting Is Scheduled Outside Your Work Hours
  3. If you select “Yes”, Outlook will immediately send out an accepted response.
  4. If select “NO”, Outlook will send out a declined response at once.

Get Rid of Annoying PST Errors

As Outlook PST is susceptible to errors, you will be likely to meet various issues in your Outlook. Therefore, the best precaution is to prepare a potent PST fix tool in vicinity, such as DataNumen Outlook Repair, such that your PST file can get immediate rescue if it gets corrupted.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including SQL Server damage and outlook repair software products. For more information visit

Comments are closed.