Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

KMail has a really useful feature: you can define a series of rules which are only run when you press a keyboard shortcut, and then only on the highlighted messages. This allows me to read a message as it comes into the inbox, and then file it away with one key press.

How can I replicate this in Outlook? Possibly some VBA script triggered by a key press that runs all rules against all messages currently selected?

share|improve this question

3 Answers 3

How big is your folder? You can Run rules manually, but that applies to the whole folder, but I imagine that this could be really slow if your folder has a large number of messages.

That link describes using 'Manage Rules & Alerts' in the File tab to 'Run Rules Now'.

share|improve this answer

Unfortunately, there is no way to run Outlook rules on selected messages. Only on folders. :-( Even using Outlook Object Model in VBA.

share|improve this answer

You can help yourself with an auxiliary routine like this:

Public Sub TestMessageRule()
    '  Routine to test Mail Handlers MessageRule()'
    '  without incoming mail messages
    '  select an existing mail before executing this routine
    Dim objItem As Object
    Dim objMail As Outlook.mailItem
    Dim started As Long

    For Each objItem In Application.ActiveExplorer.Selection
        If TypeName(objItem) = "MailItem" Then
            Set objMail = objItem

                '  add the following declaration at the header:
                '  Private Declare Function GetTickCount Lib "kernel32.dll" () As Long
                started = GetTickCount()
                MessageRule objMail

                ' showCheckerMail objMail.BillingInformation
                Debug.Print "elapsed " & (GetTickCount() - started) / 1000# & "s"
        End If
    Next
End Sub
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.