Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-23-2013, 09:50 AM
niton niton is offline Rule to turn off a rule Windows 7 64bit Rule to turn off a rule Office 2012
Competent Performer
 
Join Date: Jul 2012
Posts: 102
niton is on a distinguished road
Default

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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Out Of Office Rule Not Selected DrDOS Outlook 0 11-27-2011 02:30 PM
1 Calendar to rule them all... halcyoneus Outlook 0 11-18-2011 02:57 PM
Rule to reply GeeksBsmrT Outlook 0 08-25-2010 07:08 AM
Rule to turn off a rule Facebook rule? markg2 Outlook 3 08-06-2010 05:17 AM
Rule runs once, but not later stlsailor Outlook 0 07-28-2009 08:18 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:34 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft