Outlook: Run inbox rules on read messages only (VBA)

This is how to get email rules to run after you have read the message as opposed to when they are received. To me, this is one of the most obvious features MS Outlook should have, out the box.

This VBA code will process any rule that’s name begins with “_cu” – used to differentiate between “normal” rules and the rules run by this macro.

It’s up to you how you create the macro, but this is how I do it:

Create the Macro

  1. In Outlook, right-click on the ribbon (tool bar)
  2. Click Customise the Ribbon…
  3. In the right-hand list, tick Developer and click OK.
  4.  Select the Developer tab (See tip if it’s not available).
  5. Click Visual Basic icon.
  6. In the Project area, expand Project1 > Microsoft Outlook Object.
  7. Double-click ThisOutlookSession
  8. In the code window, paste in the code below
  9. Close and return to Outlook. (The file is automatically saved).

 

Create the Button

I’m sure it’s possible to get this macro to run when Outlook changes the status of a message from Unread to Read or on a timer. For now, I am using a manual button.

  1. In Outlook, right-click on the ribbon (tool bar).
  2. Click Customise the Ribbon…
  3. Select the tab where you want the button to live. For example “Home (Mail)”.
  4. Create a new group by clicking New Group.
  5. Right-click “New Group (Custom)” and click Rename.
  6. Give it a meaningful name. For example: My Group.
  7. Using the up and down arrow buttons, move the new group to where you want it. I have mine between “New” and “Delete”.
  8. In the “Choose commands from:” drop down, select Macros.
  9. Drag the new macro (Project1.ThisOutlookSession.RunA…) to your new group.
  10. Right-click the new macro and click Rename.
  11. Select a suitable icon and give it a suitable name.
  12. Click OK.

 

Create a rule.

At this point, clicking your shiny new button won’t do anything, as there are no rules for it to process.

  1. Create a rule that moves email from someone to a folder in your inbox
  2. In Rules and Alerts, untick the rule so it doesn’t run as email is received.
  3. Rename the rule so the name starts with _cu
  4. Click OK.

 

Now try the button. Once the email is marked as read, it should move it to the desired folder and if it has not been read, it won’t move it.

 

 

 

Tip: If your admin locks down the Developer feature in Outlook (Office), the vba is stored in ???. I have successfully coded the VBA on computer A and copied this file to computer B, then pointed an Icon at it by function name only. If you have other macro’s and you overwrite this file, they’ll be lost.

One thought on “Outlook: Run inbox rules on read messages only (VBA)

  1. Natalie Bourke

    Is it possible to add a timeframe to this? Say move emails in inbox marked as read greater than 7 days? Thanks

Please feel free to leave a comment...