Quickly running Outlook rules on demand?

Solution 1:

You could either:

  1. Add the Run Rules Now... menu item to your menu (Via Tools|Customize); or
  2. You could write a bit of VBA to run a specific rule (see here: http://pyrocam.com/how-to-run-outlook-2007-rules-from-a-button/)

Solution 2:

I wanted to do the same thing, more or less. There are emails that I file via rules as soon as they hit my inbox – I don't even look at them. Then there are others that I need to see and read, but once I do I could also have a rule to file them quickly. This is where the rules system in Outlook seems to fail. It happens only on new items, mostly so that the Exchange server can do it on its own. So I waste a lot of time dragging read messages to the correct folder – and I have several hundred of those.

Here is how I implemented it, in basic steps:

  1. Created a category called "Auto-file".
  2. Wrote rules which checked for category "Auto-file" as part of the criteria. Saved them with Fileit: in the name to show me that these were category-based rules (i.e., delayed action, unlike my other rules).
  3. Wrote a macro (below) that sets the selected mail items to this category, marks them as read, then runs the rules with rule names starting with Fileit.
  4. Added a button to my main toolbar to run this macro.

So now, to file stuff in my inbox that I have read, I select it and hit the button and it all goes away by magic, based on my Fileit rules. I don't use the category otherwise, so this works for me. Note too that the category setting remains (which could be considered a plus). If you already use categories a lot, this would not work so well. Be aware that this turns the rule into a "Client-only" rule (the category bit does this), which basically means Exchange can't run it for you – which is fine, but it will warn you of this when you save the rule. The code is nothing fancy and you could almost certainly do it yourself in a few minutes, but I give it here to copy/paste if you like.

Sub myFileItMacro()
    ' 2015-06-24 SWB First attempt to automate Outlook filing
    ' Note that Outlook 2013 does not have a macro recorder, which doesn't help.
    Dim myItem As Outlook.MailItem
    Dim intItemCount As Integer
    Dim myRules As Outlook.Rules
    Dim myRule As Outlook.Rule
    Dim intLoop As Integer

    ' Used to set category of more than one item ...
    intItemCount = Application.ActiveExplorer.Selection.Count
    If intItemCount > 0 Then        ' ... and to check at least one is selected

        ' Next, assign it to the category.  This should be set up beforehand.
        For intLoop = 1 To intItemCount
            ' This could throw an error if there is nothing selected, presumably.
            Set myItem = Application.ActiveExplorer.Selection.Item(intLoop)

            myItem.Categories = "Auto-file"
            myItem.UnRead = False           ' Flag as read
            ' You should be able to see this in the category column once this line runs.
            myItem.Save
        Next

        ' Lastly, run the rules on the inbox, although, it would be even better
        ' to run rules just on this item.  Hmmm
        ' You have to do this by going through the rules.
        Set myRules = Application.Session.DefaultStore.GetRules
        For Each myRule In myRules
            ' Execute only rules named starting with "Fileit".
            ' These have the category filter.
            If Left(myRule.Name, 6) = "Fileit" Then
                myRule.Execute (False)
            End If
        Next

    End If

End Sub

Appended from second answer.

I forgot to mention that in Outlook 2010 and 2013 (or 365 if you like) there are "Quick Steps". These sort of allow you to set up an auto-file button. The issue I have with those are that you need to set one up per rule. If I have 50 things I want to file to 50 folders, I need 50 quicksteps and it kind of defeats the purpose as you will spend just as long finding the right quickstep as dragging the emails to the right (sub)folder. I could be wrong here, and if I am please correct me, but that is my understanding.

The advantage of the code above is that you can have ONE button in your ribbon that you press to apply a number of different rules, even if multiple items are selected the right rule will be applied to each. The only disadvantage I have found is that if I have not set up a rule (it is hard to remember them all after a while, I have a home and work PC etc) it will just set the category and the email will not move. Not a big deal. Oh, and you have to allow macros to run because clearly they are evil.

I know that the original poster was back in 2011, they have probably totally forgotten all about this, but the question actually is still valid and largely unanswered on the great internet, so I thought I would contribute! It is one area where I think the usability of Outlook is really lacking, and it all comes down to the first part of the rules, which are "Apply this rule after the message arrives". If you could change this to "Apply this rule when I press a button" or similar, you would not need my code. At least you can set a rule to be based on a category, which is why the code above works.