Automating Outlook Out of Office

15 pts.
Tags:
Outlook
Outlook Out of Office
is it possible to automate the out of office function as i job share and am only in the office 3 days a week, so emails that come in from anyone automatically get the out of office message without me having to set the out of office each week. (In case I forget to set it) Thanks

Answer Wiki

Thanks. We'll let you know when a new response is added.

I found some Visual Basic Application code that you can use to automate when you close outlook to display an out of message reply.

Here is the code:

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

Here are the instructions to get this going:

1. Open up Outlook.
2. Click Tools->Macros->Visual Basic Editor.
3. If not already expanded, expand Microsoft Office Outlook Objects and select ThisOutlookSession.
4. Copy the code and paste it into the right-hand pane of the VB editor.
5. Click the diskette icon on the toolbar to save the code.
6. Close the VB editor.
7. Click Tools->Macros->Security.
8. Change the security level to Medium.
9. Click Ok.
10. Close Outlook.
11. Start Outlook.
12. You’ll receive a dialog-box telling you that ThisOutlookSession contains macros and asking if you want to enable them. Click Enable Macros.
13. Try closing Outlook. When you do a dialog-box should appear asking if you want to turn the Out of Office Assistant on. If you click Yes it will be turned on.

Clicking No will leave it off.

Discuss This Question: 8  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    what mail software (client and server) are you using ?
    68,780 pointsBadges:
    report
  • Technochic
    I expect you are using outlook. What version and service pack level please?
    57,010 pointsBadges:
    report
  • UNSW
    Hi yeah Microsoft Outlook 2007 - I believe it's SP1. Cheers
    15 pointsBadges:
    report
  • Technochic
    Karl, what a great solution, thanks for posting that!
    57,010 pointsBadges:
    report
  • Birdlog
    simple but useful nice one chap!
    10 pointsBadges:
    report
  • Jbrickey
    This doesn't appear to be working in Outlook 2007. I receive a Run-time error on Set objMAPISession = CreateObject("MAPI.Session"). Any suggestions? Thanks!
    10 pointsBadges:
    report
  • Pappu
    Hi All, For the above code to work in Outlook 2007 try installing the package at http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=3671. This should solve the problem for run time errors during the code execution. Thanks, Pappu.
    10 pointsBadges:
    report
  • mwhelp
    What should the code be when you have Application_Start()? Need something to run when they turn outlook on and when they logoff.
    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following