Is it possible to make Outlook 2010 turn on the "Automatic Replies" feature when I close the application? I like to turn on "Out of Office" at the end of the day but in a hurry it's easily forgotten.

link|improve this question
feedback

3 Answers

It appears Outlook generates an Application_Quit event when closing that could be hooked to set the OOF. Pressing Alt-F11 in Outlook brings up the macro editor. Start poking around there.

link|improve this answer
feedback

Awesome! Thanks KCotreau. I got it working on MS Outlook 2003. Below is the code snippet - I just wrapped it wihtin the pre and code to not have it all in a single line.

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

This is nice, but is it possible to have it actually run at a future day/time? That will be a real plus, because if you have a vacation planned and forget to turn OOF, it will automatically kick in without human intervention...eh?

link|improve this answer
feedback

I REALLY tried to make this work for you, but I learned that Outlook 2010 no longer supports CDO 1.2.1, and not being a programmer, I did not have the deep knowledge to code it another way. Although unsupported and not recommended by Microsoft (why do they mention it then??), it is possible to install CDO if you have Outlook 2007, before you upgrade to Outlook 2010.

http://support.microsoft.com/kb/2028411

I am going to post how to do this in Outlook 2003/2007 in case anyone happens upon this. I just tested this. I will also post the other steps for Outlook 2010 ASSUMING YOU CAN FIX THE CODE.

For Outlook 2003/2007

  1. For Outlook 2007 only, you must install CDO or the code will fail: http://www.microsoft.com/downloads/en/details.aspx?familyid=2714320d-c997-4de1-986f-24f081725d36&displaylang=en

  2. Assuming your company's group policy does not override this, change the security in ToolsMacrosSecurity to No Security Check for macros.

  3. Go to ToolsMacrosVisual Basic Editor.

  4. Click on the Visual Basic icon, and hit F2 to open the objects browser.

  5. In the new project in the left pane expand it until you see ThisOutlookSession and double-click it.

  6. Cut and paste the following code into the code window that just opened 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
    
  7. Close and open Outlook.

  8. It will give you a message about macros. Enable them.

For Outlook 2010

If you can fix the code, here are the steps for Outlook 2010. I include them because the locations of many items have changed, and could be hard to find. In the current code, I also point out the step that fails.

  1. Assuming your company's group policy does not override this, change the security in FileOptionsTrust CenterTrust Center SettingsMacro Settings to Enable all macros.

  2. Start by enabling the Developer tab in FileOptionsCustomize Ribbon, check Developer in the right column.

  3. Click on the Visual Basic icon, and hit F2 to open the objects browser.

  4. Go to Classes (left column) → ThisOutlookSession and double-click it.

  5. Cut and paste the following code into the code window that just opened 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") THIS IS THE STEP THAT FAILS
            objMAPISession.Logon , , True, False
            objMAPISession.OutOfOffice = True
            objMAPISession.Logoff
        End If
        Set objMAPISession = Nothing
    End Sub
    
  6. Close and open Outlook.

  7. Go back to the Developer tab → Macros icon. It will give you a message about macros. Enable them.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.