• Outlook User
  • New Outlook app
  • Outlook.com
  • Outlook Mac
  • Outlook & iCloud
  • Developer
  • Microsoft 365 Admin
    • Common Problems
    • Microsoft 365
    • Outlook BCM
    • Utilities & Addins

Enable or Disable an Outlook Rule using Reminders

Slipstick Systems

› Developer › Enable or Disable an Outlook Rule using Reminders

Last reviewed on September 16, 2019     45 Comments

Applies to: Outlook (classic), Outlook 2007, Outlook 2010

The ability to use VBA to control Outlook's rules was added to Outlook 2007. For this reason, this macro will not work with Outlook 2003 or older.

In the enable and disable macro, replace "Your Rule Name" with the name of the rule you want to enable and disable.
Enter the name of the rule in the VBA code
Set olRule = olRules.Item("Your Rule Name")

To use: Create a task with the subject "Disable Rule" and set the reminder time for the time you want the rule to be disabled. Create a second task with the subject "Enable Rule" with the reminder time set for the time you want it enabled.

This, of course, only works if Outlook is running. It is not possible to enable and disable rules when Outlook is closed.

VBA code sample to enable or disable rules

Use Alt+F11 to open the VBA Editor and place this code in ThisOutlookSession.

If you prefer to use Appointments instead of Tasks, replace IPM.Task with IPM.Appointment. If you are using recurring events to turn the rule off and on, an appointment might be better as the reminder is less likely to be accidentally disabled.

Private Sub Application_Reminder(ByVal Item As Object)

If Item.MessageClass <> "IPM.Task" Then
  Exit Sub
End If

If Item.Subject = "Enable Rule" Then
  Enable_Run_Rule
End If

If Item.Subject = "Disable Rule" Then
 Disable_Run_Rule
End If

End Sub

' Macro to enable a rule
Sub Enable_Run_Rule()
Dim olRules As Outlook.Rules
Dim olRule As Outlook.Rule
Dim intCount As Integer
Dim blnExecute As Boolean
 
    Set olRules = Application.Session.DefaultStore.GetRules
    Set olRule = olRules.Item("Your Rule Name")
    olRule.Enabled = True
    If blnExecute Then olRule.Execute ShowProgress:=True
     olRules.Save
  
    Set olRules = Nothing
    Set olRule = Nothing
End Sub

' Macro to disable a rule
Sub Disable_Run_Rule()
Dim olRules As Outlook.Rules
Dim olRule As Outlook.Rule
Dim intCount As Integer
Dim blnExecute As Boolean
 
    Set olRules = Application.Session.DefaultStore.GetRules
    Set olRule = olRules.Item("Your Rule Name")
    olRule.Enabled = False
    If blnExecute Then olRule.Execute ShowProgress:=True
       olRules.Save
  
    Set olRules = Nothing
    Set olRule = Nothing
End Sub

 

Use with multiple rules

To apply this to multiple rules, assign categories called Enable Rule or Disable Rule to a task and use the rule name as the task subject. Use an If... then statement in the VBA to check for the category and pass the rule name to a function.

In the following code, I condensed it to one function that gets the rule name and whether the rule should be enabled or disabled, passing both values to the function.

Private Sub Application_Reminder(ByVal Item As Object)
Dim strRule As String

If Item.MessageClass <> "IPM.Task" Then
  Exit Sub
End If

strRule = Item.Subject

If Item.Categories = "Enable Rule" Then
Run_Rule strRule, 1
End If

If Item.Categories = "Disable Rule" Then
Run_Rule strRule, 0
End If

End Sub

Function Run_Rule(rule_name As String, tf As Boolean) As Boolean
Dim olRules As Outlook.Rules
Dim olRule As Outlook.Rule
Dim blnExecute As Boolean

    Set olRules = Application.Session.DefaultStore.GetRules
    Set olRule = olRules.Item(rule_name)
    
    olRule.Enabled = tf
    
    If blnExecute Then olRule.Execute ShowProgress:=True
     olRules.Save
  
    Set olRules = Nothing
    Set olRule = Nothing
End Function

Toggle the rule on or off

If you want to use one macro and toggle the rule on or off, you can change olRule.Enabled = True to

If olRule.Enabled = True then
    olRule.Enabled = False
Else 
    olRule.Enabled = True

More Information

Enable / Disable rules code sample from Outlook Code.com
Run Rules Now using a Macro
VBA to Sort Rules [A-Z] - code provided

Enable or Disable an Outlook Rule using Reminders was last modified: September 16th, 2019 by Diane Poremsky
Post Views: 94

Related Posts:

  • Run Rules Now using a Macro
  • Creating an AND rule in Outlook Rules
  • Disable New Mail Notifications for Some Accounts
  • Disable Outlook's No Subject Warning using VBA

About Diane Poremsky

A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Comments

  1. Jane Wilkinson says

    August 22, 2022 at 12:13 pm

    A total newbie. I have done what you say at the start but I am confused as to how the marco will know what rule to run if I apply it to multiple reminders. Also once I have created the macro what do I do then?

    Reply
  2. Binu Mathew says

    April 13, 2022 at 6:53 am

    Thank you very much

    Reply
  3. Marius says

    April 15, 2021 at 9:46 am

    Hi, sorry for asking a newbie question. I have entererd your macro 1:1 in my outlook 2019. The macro doesnt start either. If i start it in the VBA editor there is a error missing object. How can i solve this problem?
    Thanks and regards Marius

    Reply
  4. Darin says

    January 11, 2018 at 9:50 am

    hi! I'm a beginner :) but was looking to try and create a macro that would turn on or off a specific rule based on my input (I would then assign that Macro to a toolbar in the ribbon) Anyone created that previously per chance?

    Reply
    • Diane Poremsky says

      February 13, 2018 at 9:25 am

      Do you want to call the macro from a button? The macros named Sub Enable_Run_Rule() and Sub Disable_Run_Rule() that are part of the reminder macro can be run manually.

      Reply
  5. Vidar says

    December 5, 2017 at 2:59 am

    Hello! I know this is an old post, but I hope someone can help me out anyway.

    I have created the following:
    - a rule called "TEST-OOO"
    - the Enable and Disable appontments with reminders
    - the VBA, changing "Your Rule Name" to "TEST-OOO" and replacing IPM.Task with IPM.Appointment

    The Enable reminder shows at the time set, but the rule is not enabled.

    What have I misunderstood? Do I need to do something else?

    Reply
    • Diane Poremsky says

      December 6, 2017 at 12:25 am

      To the best of my recollection, that should work. What version and build of Outlook? I know Outlook 2016 tightened some security around rules but i didn't think it affected this.

      Add some MsgBox at various points to see if they come up, starting with the enable and disable functions. Add a message box in the Enable_Run_Rule and disable subs too - somewhere near the top.
      If Item.Subject = "Enable Rule" Then
      MsgBox "Enable Rule fired"
      Enable_Run_Rule
      end if

      Reply
      • Diane Poremsky says

        December 6, 2017 at 12:32 am

        I just tested it here in Outlook 2016, it is working.

      • Vidar says

        December 15, 2017 at 6:02 am

        Dear Diane,

        I tried to write you an answer, but I believe the message got "hung" somewhere...

        Thank you for your prompt reply, it was very helpful. I was using Outlook 2010 and couldn't get it to work. But when I switched to a computer with Outlook 2016 it worked like a charm :)

        But I encountered another "challenge" that you can possibly assist with.

        For the auto reply rule I used the "reply using a specific template" option. This apparently only sends out the auto reply once for each sender. I would very much like it to send the auto reply every time for every sender, regardless of how many emails i receive from the sender.

        Is is possible to achieve this somehow?

        Thank you for your assistance, it is highly appreciated :)

        Regards, Vidar

      • Diane Poremsky says

        December 23, 2017 at 12:16 am

        It's 'hung' in the moderation queue - i leave everything there until i have time to reply, as it makes it easier to find the messages that need answered.

        Reply with template is one per sender until outlook is restarted. if you use a run a script macro to send the template, it will reply to all messages from the sender.
        https://www.slipstick.com/developer/run-a-script-rule-autoreply-using-a-template/

    • Diane Poremsky says

      December 6, 2017 at 12:28 am

      Oh, did you put it in thisoutlooksession? Because its triggered automatically, it needs to be in thisoutlooksession, not a module. Also, i'm assuming you set macro security to low for testing?

      Reply
      • Vidar says

        October 24, 2018 at 2:16 am

        Dear Diane,

        First of all, thank you for this nice solution. It has really helped me a lot!

        Most of the time the Outlook rule gets enabled/disabled as it should. However, it happens from time to time that the rule is NOT enabled/disabled.

        I don't know the reason for this, but I would like to not having to check this manually twice a day.

        Is there a way to have Outlook send me an email every time the rule is actually enabled/disabled, just to let me know everything is as it should be?

        Thank you for all your assistance, it is much appreciated :)

        Regards, Vidar

      • Diane Poremsky says

        October 25, 2018 at 6:38 pm

        Sure. Use the macro at https://www.slipstick.com/developer/create-a-new-message-using-vba/ - removing the fields you don't need. You can use the macro with both enable/disable. Change .display to .send. You can call the macro after rule is changed.

        If Item.Subject = "Disable Rule" Then
        Disable_Run_Rule
        End If

        CreateNewMessage
        End Sub

        Or put this at the end, instead of the macro name:
        Dim objMsg As MailItem
        Set objMsg = Application.CreateItem(olMailItem)
        With objMsg
        .To = "Alias@domain.com"
        .Subject = item.subject
        .Body= item.subject
        .Send
        End With
        Set objMsg = Nothing

        This will only tell you if the macro ran - it doesn't confirm the change was made.

        It will be possible to get the status after the it runs, so you know if the macro worked. Something like this, but i didn't test it so it might not be quite right. Basically, we want to get the status if the rule, on or off and put the value in the body. It will either be a 1 or 0. Use it with the first example.

        Public Sub CreateNewMessage()
        Dim objMsg As MailItem
        Dim olRules As Outlook.Rules
        Dim olRule As Outlook.Rule
        Dim intCount As Integer
        Dim blnExecute As Boolean

        Set olRules = Application.Session.DefaultStore.GetRules
        Set olRule = olRules.Item("Your Rule Name")

        Set objMsg = Application.CreateItem(olMailItem)

        With objMsg
        .To = "Alias@domain.com"
        .Subject = "Your Rule Name"
        .Body = olRule.Enabled
        .Send
        End With

        Set objMsg = Nothing
        End Sub

  6. Dean says

    June 6, 2014 at 12:03 am

    Hi,

    I'm looking to implement this as a button on a toolbar. While i can create a toolbar, can you help get a link between the macro and a button?

    thanks

    Reply
    • Diane Poremsky says

      June 15, 2014 at 11:34 pm

      What version of outlook? In 2010 and 2013 you select the macro in the customize ribbon dialog. In 2007, you add the macro to the QAT. In older versions you customize the toolbar and add the macro to it.

      Reply
  7. Jacob Mabb says

    May 27, 2014 at 7:37 am

    On exchange 2007, I used 2 powershell scheduled tasks (One to enable, one to disable). The powershell scheduled tasks must be run as the mailbox user, however, this does NOT require the user to be logged into the machine or outlook to be running. It launches outlook for that user at the time of the scheduled task and enables/disables the rule.

    #Enable Rule Script
    $ol = New-Object -ComObject Outlook.Application
    $ol.visible = $true
    $namespace = $ol.GetNamespace("MAPI")
    $inbox = $namespace.GetDefaultFolder([Microsoft.Office.Interop.Outlook.OlDefaultFolders]::olFolderInbox)
    $rules = $namespace.DefaultStore.GetRules()
    $rule = $rules | Where-Object { $_.Name -eq "" }
    $rule.Enabled = $True
    $rules.Save()

    #Disable Rule Script
    $ol = New-Object -ComObject Outlook.Application
    $ol.visible = $true
    $namespace = $ol.GetNamespace("MAPI")
    $inbox = $namespace.GetDefaultFolder([Microsoft.Office.Interop.Outlook.OlDefaultFolders]::olFolderInbox)
    $rules = $namespace.DefaultStore.GetRules()
    $rule = $rules | Where-Object { $_.Name -eq "" }
    $rule.Enabled = $False
    $rules.Save()

    Reply
    • Jacob Mabb says

      May 27, 2014 at 7:39 am

      $rule = $rules | Where-Object { $_.Name -eq "" }

      You must put the name of the rule between these double-quotes.

      Reply
  8. Christopher says

    December 17, 2013 at 3:00 am

    The rules work individually but not the appointment one. regards the "schema_" I try to use it when I receive a notice that I've got an appointment

    Reply
  9. Christopher says

    December 16, 2013 at 5:30 am

    It doesn't work, I've attached all code below.

    "
    Sub Disable_Run_Rule_SOA(Item As Outlook.MailItem)
    Dim olRules As Outlook.Rules
    Dim olRule As Outlook.Rule
    Dim intCount As Integer
    Dim blnExecute As Boolean

    Set olRules = Application.Session.DefaultStore.GetRules
    Set olRule = olRules.Item("SOA")
    olRule.Enabled = False
    If blnExecute Then olRule.Execute ShowProgress:=True
    olRules.Save

    Set olRules = Nothing
    Set olRule = Nothing
    End Sub
    Sub Enable_Run_Rule_SOA(Item As Outlook.MailItem)
    Dim olRules As Outlook.Rules
    Dim olRule As Outlook.Rule
    Dim intCount As Integer
    Dim blnExecute As Boolean

    Set olRules = Application.Session.DefaultStore.GetRules
    Set olRule = olRules.Item("SOA")
    olRule.Enabled = True
    If blnExecute Then olRule.Execute ShowProgress:=True
    olRules.Save

    Set olRules = Nothing
    Set olRule = Nothing
    End Sub

    Sub Enable_Run_Rule_WebAccessNewPin(Item As Outlook.MailItem)
    Dim olRules As Outlook.Rules
    Dim olRule As Outlook.Rule
    Dim intCount As Integer
    Dim blnExecute As Boolean

    Set olRules = Application.Session.DefaultStore.GetRules
    Set olRule = olRules.Item("WebAccessNewPin")
    olRule.Enabled = True
    If blnExecute Then olRule.Execute ShowProgress:=True
    olRules.Save

    Set olRules = Nothing
    Set olRule = Nothing
    End Sub
    Sub Disable_Run_Rule_WebAccessChangePin(Item As Outlook.MailItem)
    Dim olRules As Outlook.Rules
    Dim olRule As Outlook.Rule
    Dim intCount As Integer
    Dim blnExecute As Boolean

    Set olRules = Application.Session.DefaultStore.GetRules
    Set olRule = olRules.Item("WebAccessChangePin")
    olRule.Enabled = False
    If blnExecute Then olRule.Execute ShowProgress:=True
    olRules.Save

    Set olRules = Nothing
    Set olRule = Nothing
    End Sub
    Sub Enable_Run_Rule_WebAccessChangePin(Item As Outlook.MailItem)
    Dim olRules As Outlook.Rules
    Dim olRule As Outlook.Rule
    Dim intCount As Integer
    Dim blnExecute As Boolean

    Set olRules = Application.Session.DefaultStore.GetRules
    Set olRule = olRules.Item("WebAccessChangePin")
    olRule.Enabled = True
    If blnExecute Then olRule.Execute ShowProgress:=True
    olRules.Save

    Set olRules = Nothing
    Set olRule = Nothing
    End Sub
    Sub Disable_Run_Rule_WebAccessCheckChannels(Item As Outlook.MailItem)
    Dim olRules As Outlook.Rules
    Dim olRule As Outlook.Rule
    Dim intCount As Integer
    Dim blnExecute As Boolean

    Set olRules = Application.Session.DefaultStore.GetRules
    Set olRule = olRules.Item("WebAccessCheckChannels")
    olRule.Enabled = False
    If blnExecute Then olRule.Execute ShowProgress:=True
    olRules.Save

    Set olRules = Nothing
    Set olRule = Nothing
    End Sub
    Sub Enable_Run_Rule_WebAccessCheckChannels(Item As Outlook.MailItem)
    Dim olRules As Outlook.Rules
    Dim olRule As Outlook.Rule
    Dim intCount As Integer
    Dim blnExecute As Boolean

    Set olRules = Application.Session.DefaultStore.GetRules
    Set olRule = olRules.Item("WebAccessCheckChannels")
    olRule.Enabled = True
    If blnExecute Then olRule.Execute ShowProgress:=True
    olRules.Save

    Set olRules = Nothing
    Set olRule = Nothing
    End Sub
    Sub Disable_Run_Rule_WebAccessNewPin(Item As Outlook.MailItem)
    Dim olRules As Outlook.Rules
    Dim olRule As Outlook.Rule
    Dim intCount As Integer
    Dim blnExecute As Boolean

    Set olRules = Application.Session.DefaultStore.GetRules
    Set olRule = olRules.Item("WebAccessNewPin")
    olRule.Enabled = False
    If blnExecute Then olRule.Execute ShowProgress:=True
    olRules.Save

    Set olRules = Nothing
    Set olRule = Nothing
    End Sub
    Sub Disable_Run_Rule_WebAccessPermanentLogin(Item As Outlook.MailItem)
    Dim olRules As Outlook.Rules
    Dim olRule As Outlook.Rule
    Dim intCount As Integer
    Dim blnExecute As Boolean

    Set olRules = Application.Session.DefaultStore.GetRules
    Set olRule = olRules.Item("WebAccessPermanentLogin")
    olRule.Enabled = False
    If blnExecute Then olRule.Execute ShowProgress:=True
    olRules.Save

    Set olRules = Nothing
    Set olRule = Nothing
    End Sub
    Sub Enable_Run_Rule_WebAccessPermanentLogin(Item As Outlook.MailItem)
    Dim olRules As Outlook.Rules
    Dim olRule As Outlook.Rule
    Dim intCount As Integer
    Dim blnExecute As Boolean

    Set olRules = Application.Session.DefaultStore.GetRules
    Set olRule = olRules.Item("WebAccessPermanentLogin")
    olRule.Enabled = True
    If blnExecute Then olRule.Execute ShowProgress:=True
    olRules.Save

    Set olRules = Nothing
    Set olRule = Nothing
    End Sub

    Sub Schema_SOA(ByVal Item As Object)

    If Item.MessageClass "IPM.Appointment" Then
    Exit Sub
    End If

    If Item.Subject = "Enable Rule SOA" Then
    Enable_Run_Rule_SOA
    End If

    If Item.Subject = "Disable Rule" Then
    Disable_Run_Rule_SOA
    End If

    End Sub

    Sub Schema_SIGNICAT(ByVal Item As Object)

    If Item.MessageClass "IPM.Appointment" Then
    Exit Sub
    End If

    If Item.Subject = "Enable Rule SIGNICAT" Then
    Enable_Run_Rule_WebAccessNewPin
    Enable_Run_Rule_WebAccessChangePin
    Enable_Run_Rule_WebAccessCheckChannels
    Enable_Run_Rule_WebAccessPermanentLogin
    End If

    If Item.Subject = "Disable Rule SIGNICAT" Then
    Disable_Run_Rule_WebAccessNewPin
    Disable_Run_Rule_WebAccessChangePin
    Disable_Run_Rule_WebAccessCheckChannels
    Disable_Run_Rule_WebAccessPermanentLogin
    End If

    End Sub
    "

    In Desperate times...

    Reply
    • Diane Poremsky says

      December 16, 2013 at 8:06 am

      Do the rules work individually?
      comment out the subject and replace with
      Sub Test_rule()
      Dim Item As Outlook.MailItem
      Test the enable and disable rules.

      How are you calling the two schema_ macros?

      Reply
  10. Christopher says

    December 11, 2013 at 9:19 am

    I trigger the rules by incoming e-mails and yes they work on their own.
    You are correct I've changed the names. but when I compile It shows error on the "Enable_Run_Rule_SOA"

    Reply
    • Diane Poremsky says

      December 11, 2013 at 2:24 pm

      Does it give you any error codes? AS long as you renamed the disable macro to match, it should work.

      Reply
      • Christopher says

        December 12, 2013 at 3:28 am

        Compile error: Argument not optional

      • Diane Poremsky says

        December 12, 2013 at 9:03 am

        That often means a typo - word's curly "smart" quotes instead of straight quotes, 2 single quotes instead of a double... something small and easy to overlook. The code you posted looks fine. If the enable macro looks like it does on the webpage, it should work

  11. Christopher says

    December 11, 2013 at 4:09 am

    Hi Diane!
    I can't seem to get the script to work. I've changed some names in order to keep track of what rules it applies. Please have a look

    Private Sub Schema_SOA(ByVal Item As Object)

    If Item.MessageClass <> "IPM.Appointment" Then
    Exit Sub
    End If

    If Item.Subject = "Enable Rule SOA" Then
    Enable_Run_Rule_SOA
    End If

    If Item.Subject = "Disable Rule" Then
    Disable_Run_Rule_SOA
    End If

    End Sub

    Reply
    • Diane Poremsky says

      December 11, 2013 at 9:14 am

      If you run the Sub Enable_Run_Rule_SOA() or Sub Disable_Run_Rule_SOA() by clicking the Run button, do they work? (I'm assuming you renamed Enable_Run_Rule and Disable_Run_Rule and entered the rule name in the enable and disable macros. )

      Reply
  12. Raman Deep Singh says

    July 24, 2013 at 11:32 pm

    Hi, I have outlook 2007. I need a script to run two minutes after I start outlook so that the mailbox has received all new mails. The script
    scans for a particular mail and if it hasnt arrived triggers a reminder
    or a task(someway to alert the user) and keeps reminding him every hour
    until the mail arrives. When the mail arrives, this task or reminder should be disabled or deleted.
    Can you give me some leads for this.
    Also can you tell me is it possible to run a script when a particular task fires.just as we can "run a script" if a particular mail arrives by using rules and alerts.

    Reply
    • Diane Poremsky says

      July 29, 2013 at 10:50 pm

      Hmm. I thought I answered this last week. :( You can run macros when a reminder fires. Scanning for an email is harder but doable as sperry software and others have addins that can look for sent mail that needs followed up. I don't have any code sample, but it would be fairly complicated - sperry's addin may be a more cost effective option over writing something.

      Reply
  13. Alejandro says

    June 13, 2013 at 11:07 am

    Hello, I have Outlook 2007 and do not appear in the list macros that might be missing.
    Thank you! (from Argentina)

    Reply
    • Diane Poremsky says

      June 16, 2013 at 5:33 pm

      Macros with something in the () - like this: Private Sub Application_Reminder(ByVal Item As Object) are not listed in the macros you can run manually. They run automatically when something happens.

      Reply
  14. Tom Edwards says

    June 11, 2013 at 1:28 pm

    Thanks Diane for your reply, perhaps I will just run Outlook on the PC 24/7 which probably wont be a problem.

    So, if I want to look for a string within the body of an email and enable/disable a rule based on the string being present - will the above work for me? I cant seem to get it to appear on the scripts under the rules wizard.

    Thanks

    Reply
    • Diane Poremsky says

      June 11, 2013 at 1:38 pm

      if you want to turn on a rule based on a message that was received, plug the enable/disable code into a run a script rule.

      if possible, let the rule look for the keyword then call this script -
      Sub DisableRule(Item As Outlook.MailItem)
      Disable_Run_Rule
      End Sub

      You can either call the rule macro or put the rule code in the script.

      Reply
  15. Tom Edwards says

    June 11, 2013 at 12:32 pm

    Hi Diane,

    I would love to be able to disable/enable outlook rules based on the content of a received email. I'm running Outlook 2013, using an exchange account. I have a bunch of rules that redirect emails based on a time schedule. I would also like to be able to interrupt that schedule if required.

    I need this to run on the server-side as Outlook won't actually be running 24/7, is there any way to achieve this?

    Thanks

    Reply
    • Diane Poremsky says

      June 11, 2013 at 1:18 pm

      Outlook doesn't have anything built in that can do this. If you have exchange, Out of office has some rules capability and that may be enough to meet your needs. Its not automatic but in newer versions you can set it ahead of time - it will turn itself on and off. But you will need to keep setting the start time.

      VBA is out because you can't run it on the server.

      Reply
  16. Dave mack says

    October 4, 2012 at 9:51 am

    What I really need is a macro to turn off the Out-Of-Office setting when I get back in the office. Like Office 2003 used to do and Office 2010 does not.

    Reply
    • Diane Poremsky says

      October 4, 2012 at 10:21 am

      That is not possible with a macro is 2010 - the macros that turn OOF of and on need CDO. (Well, you could install CDO... but its not supported or recommended.)

      Outlook 2010 has a feature that lets you schedule OOF, so it can turn OOF on and off automatically. It should work with at least Exchange 2007 and 2010. You need to set it up each time (you can't say 'every day at 5 pm till 8 am), but you can reschedule prior to needing it. It's too bad it's not exposed to the object model - that would be convenient.

      Reply
    • Diane Poremsky says

      October 5, 2012 at 7:59 am

      One other thing - you can use an redemption - http://www.dimastr.com/redemption/RDOOutOfOfficeAssistant.htm

      Reply
  17. Dave Mack says

    October 4, 2012 at 8:57 am

    Seems pretty useless if it does not work when Outlook is closed. My company enforces everyone logging off every night before leaving.

    Reply
    • Diane Poremsky says

      October 4, 2012 at 10:16 am

      Yeah, you'd need to run it before you log off. It would be possible to run it as Outlook is shutting down, or cobble something together with reminders to trigger the macro.

      Reply
  18. Esben Rasmussen says

    August 29, 2012 at 12:17 am

    Probably not the most elegant solution but here is what I did to get i working on another mailbox than my defailt (the applied rule is unique for that mailbox).

    ' Macro to enable a rule
    Sub Enable_Run_Rule()
    Dim olRules As Outlook.Rules
    Dim olRule As Outlook.Rule
    Dim intCount As Integer
    Dim blnExecute As Boolean
    Dim colStores As Outlook.Stores
    Dim oStore As Outlook.Store

    On Error Resume Next
    Set colStores = Application.Session.Stores
    For Each oStore In colStores
    Set olRules = oStore.GetRules
    Set olRule = olRules.Item("My rule")
    olRule.Enabled = True
    If blnExecute Then olRule.Execute ShowProgress:=True
    olRules.Save
    Set olRules = Nothing
    Set olRule = Nothing
    Next

    End Sub

    The macro to disable the rule is exactly the same - except "olRule.Enabled = False".

    Reply
    • Diane Poremsky says

      August 29, 2012 at 4:06 am

      Cool, thanks for sharing. Some of my macros aren't the most elegant but they get the job done. :)

      Reply
  19. Esben Rasmussen says

    August 27, 2012 at 11:30 pm

    Ok, just tried to use it but I get an error "The attempted operation failed. An object could not be found."

    When debugging the line "Set olRule = olRules.Item("My rule")" is highlighted.

    I suspect this is due to the fact that I have two mailboxes I monitor: Mailbox X (my default) and mailbox Y.

    I created the needed rule for mailbox Y but seeing as the macro fails could it be that it only tries to use the rules defined for the default mailbox?

    Reply
    • Diane Poremsky says

      August 28, 2012 at 5:11 am

      The macro is written for the rules in the default mailbox: Set olRules = Application.Session.DefaultStore.GetRules . That would need changed to apply to other stores.

      Reply
  20. Esben Rasmussen says

    August 27, 2012 at 6:20 am

    Awesome! This is just what I needed!

    But just to be clear: Since it is based on the reminder, your Outlook doesn't have to be opened at the time the rule should be turned off?

    E.g. if you set the reminder to 8 AM but you are late and Outlook is first started at 8.30 AM the reminder will still activate and therefore the rule will still be turned off - just later than planned?

    Reply
    • Diane Poremsky says

      August 27, 2012 at 6:36 am

      Because it is reminder-based, Outlook must be open for this to work. But yes, if you open Outlook after the reminder was supposed to fire, the macro will run when the reminder fires after-the-fact.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Visit Slipstick Forums.
What's New at Slipstick.com

Latest EMO: Vol. 31 Issue 7

Subscribe to Exchange Messaging Outlook






Support Services

Do you need help setting up Outlook, moving your email to a new computer, migrating or configuring Office 365, or just need some one-on-one assistance?

Our Sponsors

CompanionLink
ReliefJet
  • Popular
  • Latest
  • Week Month All
  • Use Classic Outlook, not New Outlook
  • How to Remove the Primary Account from Outlook
  • Reset the New Outlook Profile
  • Disable "Always ask before opening" Dialog
  • This operation has been cancelled due to restrictions
  • How to Hide or Delete Outlook's Default Folders
  • Change Outlook's Programmatic Access Options
  • Use Public Folders In new Outlook
  • Removing Suggested Accounts in New Outlook
  • How to Delete Stuck Read Receipts
  • Sync Issues and Errors with Gmail and Yahoo accounts
  • Error Opening iCloud Appointments in Classic Outlook
  • Opt out of Microsoft 365 Companion Apps
  • Mail Templates in Outlook for Windows (and Web)
  • Urban legend: Microsoft Deletes Old Outlook.com Messages
  • Buttons in the New Message Notifications
  • Move Deleted Items to Another Folder Automatically
  • Open Outlook Templates using PowerShell
  • Count and List Folders in Classic Outlook
  • Google Workspace and Outlook with POP Mail
Ajax spinner

Recent Bugs List

Microsoft keeps a running list of issues affecting recently released updates at Fixes or workarounds for recent issues in classic Outlook (Windows).

For new Outlook for Windows: Fixes or workarounds for recent issues in new Outlook for Windows .

Outlook for Mac Recent issues: Fixes or workarounds for recent issues in Outlook for Mac

Outlook.com Recent issues: Fixes or workarounds for recent issues on Outlook.com

Office Update History

Update history for supported Office versions is at Update history for Office

Outlook Suggestions and Feedback

Outlook Feedback covers Outlook as an email client, including Outlook Android, iOS, Mac, and Windows clients, as well as the browser extension (PWA) and Outlook on the web.

Outlook (new) Feedback. Use this for feedback and suggestions for Outlook (new).

Use Outlook.com Feedback for suggestions or feedback about Outlook.com accounts.

Other Microsoft 365 applications and services




New Outlook Articles

Sync Issues and Errors with Gmail and Yahoo accounts

Error Opening iCloud Appointments in Classic Outlook

Opt out of Microsoft 365 Companion Apps

Mail Templates in Outlook for Windows (and Web)

Urban legend: Microsoft Deletes Old Outlook.com Messages

Buttons in the New Message Notifications

Move Deleted Items to Another Folder Automatically

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Google Workspace and Outlook with POP Mail

Newest Code Samples

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Insert Word Document into Email using VBA

Warn Before Deleting a Contact

Use PowerShell to Delete Attachments

Remove RE:, FWD:, and Other Prefixes from Subject Line

Change the Mailing Address Using PowerShell

Categorize @Mentioned Messages

Send an Email When You Open Outlook

Delete Old Calendar Events using VBA

VBA Basics

How to use the VBA Editor

Work with open item or selected item

Working with All Items in a Folder or Selected Items

VBA and non-default Outlook Folders

Backup and save your Outlook VBA macros

Get text using Left, Right, Mid, Len, InStr

Using Arrays in Outlook macros

Use RegEx to extract message text

Paste clipboard contents

Windows Folder Picker

Custom Forms

Designing Microsoft Outlook Forms

Set a custom form as default

Developer Resources

Developer Resources

Developer Tools

VBOffice.net samples

SlovakTech.com

Outlook MVP David Lee

Repair PST

Convert an OST to PST

Repair damaged PST file

Repair large PST File

Remove password from PST

Merge Two Data Files

Sync & Share Outlook Data

  • Share Calendar & Contacts
  • Synchronize two computers
  • Sync Calendar and Contacts Using Outlook.com
  • Sync Outlook & Android Devices
  • Sync Google Calendar with Outlook
  • Access Folders in Other Users Mailboxes

Diane Poremsky [Outlook MVP]

Make a donation

Mail Tools

Sending and Retrieval Tools

Mass Mail Tools

Compose Tools

Duplicate Remover Tools

Mail Tools for Outlook

Online Services

Calendar Tools

Schedule Management

Calendar Printing Tools

Calendar Reminder Tools

Calendar Dates & Data

Time and Billing Tools

Meeting Productivity Tools

Duplicate Remover Tools

Productivity

Productivity Tools

Automatic Message Processing Tools

Special Function Automatic Processing Tools

Housekeeping and Message Management

Task Tools

Project and Business Management Tools

Choosing the Folder to Save a Sent Message In

Run Rules on messages after reading

Help & Suggestions

Submit Outlook Feature Requests

Slipstick Support Services

Buy Microsoft 365 Office Software and Services

Visit Slipstick Forums.

What's New at Slipstick.com

Home | Outlook User | Exchange Administrator | Office 365 | Outlook.com | Outlook Developer
Outlook for Mac | Common Problems | Utilities & Addins | Tutorials
Outlook & iCloud Issues | Outlook Apps
EMO Archives | About Slipstick | Slipstick Forums
Submit New or Updated Outlook and Exchange Server Utilities

Send comments using our Feedback page
Copyright © 2026 Slipstick Systems. All rights reserved.
Slipstick Systems is not affiliated with Microsoft Corporation.