How to schedule outlook 2007 rules to run at specific time
If you're new here, you may want to subscribe to Windows Reference RSS feed Thanks for visiting!
1. Open Notepad.
2. Copy the code in the snippet and paste it into Notepad. Edit the code as needed. We placed comments where things can/need to change.
'Change the following three constants as desired
Const SHOW_PROGRESS = True
Const INCLUDE_SUBFOLDERS = False
Const UNREAD_MSGS_ONLY = 2
Dim olkApp, olkSes, olkFolder, olkRule
Set olkApp = CreateObject("Outlook.Application")
Set olkSes = olkApp.GetNameSpace("MAPI")
'Change Outlook on hte next line to the name of your mail profile'
olkSes.Logon "Outlook"
Set olkFolder = olkSes.GetDefaultFolder(6)
For Each olkRule In olkSes.DefaultStore.GetRules
olkRule.Execute SHOW_PROGRESS, olkFolder, INCLUDE_SUBFOLDERS, UNREAD_MSGS_ONLY
Next
Set olkRule = Nothing
Set olkFolder = Nothing
olkSes.Logoff
Set olkSes = Nothing
Set olkApp = Nothing
4. Save the file with a .vbs extension.
5. Test the script by double-clicking it. All of your rules should execute.
6. Create a scheduled task using Windows Task Scheduler.
7. Set the task to run this script.
You still need the original code to turn rules off when you leave and turn them back on when you return to the office. If the rules are not turned off, then they will continue executing when you don’t wnat them to.
Random Posts
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically each day to your feed reader.
Trackbacks & Pingbacks
Comments
Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>






is there anyway to use this code with outlook 2003?