http://www.outlookcode.com/threads.a...essageid=28707
As indicated in the link above, for Outlook 2007 and subsequent.
Code goes in the "ThisOutlookSession" module.
To turn the rule off at startup.
Code:
Private Sub Application_Startup()
Dim olRules As Outlook.Rules
Dim olRule As Outlook.Rule
Set olRules = Application.Session.DefaultStore.GetRules
Set olRule = olRules.Item("Rule Name")
olRule.Enabled = False
olRules.Save
Set olRules = Nothing
Set olRule = Nothing
End Sub
To turn the rule on when quitting Outlook.
Code:
Private Sub Application_quit()
Dim olRules As Outlook.Rules
Dim olRule As Outlook.Rule
Set olRules = Application.Session.DefaultStore.GetRules
Set olRule = olRules.Item("Rule Name")
olRule.Enabled = True
olRules.Save
Set olRules = Nothing
Set olRule = Nothing
End Sub