Automate Out of Office
Automate Out of Office
I have been asked by one of my client 'Is it possible to automate out of office upon outlook exit'? The answer is YES, it can be easily accomplished with few easy steps.
First within Outlook - go to Tools - Macros - Visual Basic Editor
A separate window will open, paste the below code on the right side as shown below and save it.
Private Sub Application_Quit()
Dim objMAPISession As Object
Set objReminders = Nothing
If MsgBox("Would you like to turn the Out of Office Assistant on?", vbYesNo, "Activate Out of Office Assistant") = vbYes Then
Set objMAPISession = CreateObject("MAPI.Session")
objMAPISession.Logon , , True, False
objMAPISession.OutOfOffice = True
objMAPISession.Logoff
End If
Set objMAPISession = Nothing
End Sub
(I should thank the person who wrote the below code, it made my job easy)
Exit from this window and now go to Tools - Macros again and select Security (You need to reduce security level from High to Medium to allow Macros)
Click ok and it should allow pop up for confirmation to turn on/off Out of Office when you close & open outlook every time


Brilliant article. Very useful!
Reply to this