Rules and Alerts: Run a Script

How to use a VBA script in Rules

Using the "Rules and Alerts" option to "run a script", the list of scripts to run is empty. What makes a script appear in the list?

The argument must by of type MailItem or MeetingItem for the subroutine to be available in the Rules Wizard.

Something like this:

Public Sub ShowMessage(Item As Outlook.MailItem)
    'code
End Sub


 

Using VBA Editor

VBA EditorOpen Outlook's VBA editor by pressing Alt+F11 and expand Microsoft Office Outlook Objects then double click on ThisOutlookSession.

You'll type or paste the code into the module, then create the rule with the 'run script' Action and select this script