How To – Redirect emails after hours.

Requirements: Microsoft Outlook, VB SCript
[skill_bar heading=”Cyclomatic Complexity” percent=”10%” bar_text=”VB Script”]

1. Start Outlook
2. Click Tools->Macro->Visual Basic Editor
3. If not already expanded, expand Microsoft Outlook Objects in the Project pane, then click on ThisOutlookSession
4. Copy the script below
5. Paste the script into the right-hand pane of the VB Editor
6. Edit the script making the changes as per the comments I included in the code
7. Click the diskette icon on the toolbar to save the changes
8. Close the VB Editor
9. Click Tools->Macro->Security
10. Set Security Level to Medium
11. Close Outlook
12. Start Outlook
13. A dialog-box will appear telling you the ThisOutlookSession contains macros and asking if you want to enable them. Say yes.
14. Test the macro
15. When the macro runs Outlook will present you with another dialog-box advising that a program is trying to access your mailbox and asking if you want to allow it to. Say yes.
16. If a message from the designated user, with the specified subject is in the mailbox, and if the time is currently between 9:00am and 5:00pm, then the message will be moved to the destination folder. Otherwise, nothing will happen.
17. Once you’ve verified that the macro works as expected, then you need to sign the macro to avoid having Outlook security warn you each time the macro runs. Here’s a link to instructions on exactly how to go about doing that: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_dsvba.asp