Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-13-2013, 08:32 AM
tiger10012 tiger10012 is offline Rule to turn off a rule Windows XP Rule to turn off a rule Office 2007
Novice
Rule to turn off a rule
 
Join Date: Feb 2013
Posts: 1
tiger10012 is on a distinguished road
Default Rule to turn off a rule


Hi Everyone,
I have a rule, called autoforward email, which I use remotely on a few occasions. The problem is that I never remember to turn the rule off after I am done with it.
Is it possible to write a macro which enables the moment I start outlook? I wanted it to look to see if the rule is on, and, if the rule is on, then disable the rule. I am looking to have the validation occur every time I first start Outlook. I am using Outlook 2007.
Thanks in advance!
Reply With Quote
  #2  
Old 02-14-2013, 10:36 AM
dr4ke dr4ke is offline Rule to turn off a rule Windows XP Rule to turn off a rule Office 2007
Novice
 
Join Date: Mar 2011
Posts: 8
dr4ke is on a distinguished road
Default

Why don't you just create a calendar entry, every morning, to prompt you to turn it off? You're over looking this... KISS (Keep It Simple Stupid).

P.s. no offence with the 'Stupid' - it's part of the saying
Reply With Quote
  #3  
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

Thread Tools
Display Modes


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 04:40 PM.


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