Auto Reply
Feature helps user to set automatic reply to the sender when you are away from your outlook mailbox. Conceptually, auto reply instructions saved on the Outlook Exchange Server having (Start Date/time, End Date/time a default message).
Prerequisites
Outlook redemption library which can be downloaded from here.
Code example
Sub SetAutoReply(oSDate As Date, oEDate As Date) Dim oStartDate As Date Dim oEndDate As Date Set objrdo = CreateObject("Redemption.objRdoSession") 'Set Start date oStartDate = oSDate 'Set End Date oEndDate = oEDate 'Enable session Session.Logon objrdo.MAPIOBJECT = Application.Session.MAPIOBJECT objrdo.Credentials.Add "outlook.office365.com", "myemail@domain.com", "password" 'Iterate each store Dim Store As Object For Each Store In objrdo.Stores If (Store.StoreKind = skPrimaryExchangeMailbox) Then Debug.Print Store.Name If Store.Name = "myemail@outlook.com" Then GoTo NextStore End If 'Instantiate out of office assistant object Dim oOutOfAssistant As Object Set oOutOfAssistant = Store.OutOfOfficeAssistant 'Configure With oOutOfAssistant .OutOfOffice = True .BeginUpdate .StartTime = oStartDate + #9:00:00 AM# .EndTime = oEndDate + #9:00:00 PM# .State = 2 .ExternalAudience = 2 'Set message default body .OutOfOfficeTextInternal = "<html><body>I am out of the office currently and will return on " & Format(oOutOfAssistant.EndTime, "dddd, MMMM dd, yyyy at hh:mm AM/PM") & "." & _ "</body></html>" .OutOfOfficeTextExternal = "<html><body>I am out of the office currently and will return on " & Format(oOutOfAssistant.EndTime, "dddd, MMMM dd, yyyy at hh:mm AM/PM") & "." & _ "</body></html>" .EndUpdate End With End If NextStore: Next Store 'CleanUp If Not objrdo Is Nothing Then Set objrdo = Nothing End If If Not Store Is Nothing Then Set Store = Nothing End If If Not oOutOfAssistant Is Nothing Then Set oOutOfAssistant = Nothing End If End Sub
Next >> Filter meetings based on date using VBA in Outlook