How to Auto Reply Incoming Emails in Outlook When You Are Busy or Out of Office

In Outlook calendar, you can show your appointments as busy, tentative, free or out of office. This article will teach you how to make Outlook auto reply the incoming emails when you are busy or out of office.

As you can see, you’re permitted to show your appointments or meetings as busy, tentative, free or out of office. Therefore, by this means, you can set the busy/free information of specific time intervals in your calendar. If you are accustomed to use this feature, you may hope that Outlook can automatically reply the incoming emails when you are busy or out of office. Hence, here we will introduce how to use VBA to let Outlook auto check your busy/free information of current time when an incoming email arrives in your mailbox. If you are busy or out of office, Outlook will auto send a reply.

Auto Reply Incoming Emails in Outlook When You Are Busy or Out of Office

Auto Reply the Incoming Email When You Are Busy or Out of Office

  1. In the first place, start your Outlook application.
  2. Then you need to enter VBA editor window, either by clicking on the “Visual Basic” button under “Developer” tab or pressing “Alt + F11” keys.
  3. Next open the “ThisOutlookSession” project window.
  4. Subsequently, copy and paste the following VBA codes into it.
Public 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 objMail As Outlook.MailItem
    Dim objAutoReply As Outlook.MailItem
    Dim strReplyBody As String
    Dim objAppointments As Outlook.Items
    Dim strFilter As String
    Dim objRestrictAppointments As Outlook.Items
    Dim objAppointment As Outlook.AppointmentItem

    If Item.Class = olMail Then
       Set objMail = Item
       Set objAutoReply = objMail.Reply
       strReplyBody = objAutoReply.HTMLBody
 
       Set objAppointments = Outlook.Application.Session.GetDefaultFolder(olFolderCalendar).Items
       objAppointments.Sort "[Start]"
       objAppointments.IncludeRecurrences = True
       strFilter = "[Start]<= '" & Format(Now, "ddddd h:nn AMPM") & "' AND [End]>= '" & Format(Now, "ddddd h:nn AMPM") & "'"
       'Find the appointments occurring currently
       Set objRestrictAppointments = objAppointments.Restrict(strFilter)
 
       If Not (objRestrictAppointments Is Nothing) Then
          For Each objAppointment In objRestrictAppointments
              'Check the busy/free information
              If objAppointment.BusyStatus = olBusy Or olOutOfOffice Then
                 objAutoReply.HTMLBody = "<HTML><BODY>I'm SORRY that I can't respond to you right now. I'll reply to you later.</HTML></BODY>" & strReplyBody
              End If
          Next
          objAutoReply.Send
       End If
    End If
End Sub

VBA Codes - Auto Reply Incoming Emails When You Are Busy or Out of Office

  1. After that, sign this code as usual.
  2. Later change your Outlook macro settings to permit the signed macros only.
  3. Finally restart your Outlook to activate the new VBA project.
  4. From now on, every time a new email lands into your Inbox folder, Outlook will auto check the busy/free information of the current time. If you are busy or out of office, Outlook will auto send out a reply, like the following image.Auto Reply

Cope with Frequent PST Errors

Perhaps you have been plagued by various PST issues for long time in Outlook. It is recommended that you had better make some precautions and prepare some solutions. For instance, you have to back up your PST data on a regular basis. In addition, you should get hold of a robust repair tool, such as DataNumen Outlook Repair, which can fix PST issues effectively without breaking a sweat.

Author Introduction:

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

Comments are closed.