Outlook - One Rule To Rule Them All

Whether you use folders, categories, archives, search folders, or a combination of those options to keep your inbox organized one thing remains constant - Outlook rules make this task simpler.  Personally I prefer to categorize my messages as they arrive (or at the end of the day if I am being a bit lazy) and move it into another folder to keep my Inbox squeaky clean and devoid of a bunch of old messages.  I use a handful of rules to automatically categorize and then move them once they have been categorized.  Instead of running each rule individually, I have been using the rule below to trigger all enabled rules to execute with the click of one button.

You can download the rule here or copy/paste the code below into an Outlook Macro.


   1: Sub RunAllRules()
   2:     Dim st As Outlook.Store
   3:     Dim myRules As Outlook.Rules
   4:     Dim rl As Outlook.Rule
   5:     Dim count As Integer
   6:     Dim ruleList As String
   7:     'On Error Resume Next
   8:     
   9:     ' get default store (where rules live)
  10:     Set st = Application.Session.DefaultStore
  11:     ' get rules
  12:     Set myRules = st.GetRules
  13:     
  14:     ' iterate all the rules
  15:     For Each rl In myRules
  16:         ' determine if it's an Inbox rule
  17:         If rl.RuleType = olRuleReceive AND rl.Enabled Then
  18:             ' if so, run it
  19:             rl.Execute ShowProgress:=True
  20:             count = count + 1
  21:             ruleList = ruleList & vbCrLf & rl.Name
  22:         End If
  23:     Next
  24:     
  25:     ' tell the user what you did
  26:     ' ruleList = "These rules were executed against the Inbox: " & vbCrLf & ruleList
  27:     ' MsgBox ruleList, vbInformation, "Macro: RunAllInboxRules"
  28:     
  29:     Set rl = Nothing
  30:     Set st = Nothing
  31:     Set myRules = Nothing
  32: End Sub

I have added a button to the Outlook Toolbar so I can execute this Macro with one simple click, but you can manage this rule however you feel appropriate.

Outlook Toolbar Button

$DNK$

  • Permanent link to this post Permalink 
  • Share this post! Share It! 
  • View this post's comments Comments (2) 
  • RSS Feed for this post's comments Comment RSS
  •    


Comments

Posted on 05.2.2008 10:01 AM #

E Thompson

E Thompson us
Genius. I have so many rules it's extremely bothersome to have to execute each one individually. Hopefully this little D/L will solve my problems. Thanks!

Posted on 05.2.2008 10:11 AM #

E Thompson

E Thompson us
This doesnt work in my outlook. Dont know if it's user error or what

pls advise- jazzed_out@yahoo.com

thx

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

Posted on 07.4.2008 15:47 PM #


search


AddThis Feed Button

blog categories

blog tags

my pictures

Flickr Gallery Coming Soon!

recent comments   RSS Feed for this post's comments