How to Quickly Disable All Rules Related to a Specific Folder in Outlook

If you would like to quickly find and disable all the rules which are related to a specific mail folder in your Outlook, you can use the way introduced in this article.

Sometimes, you may want to batch disable all the rules that are involved with a specific mail folder in your Outlook. For instance, you intend to delete a certain folder. In this case, all the rules related to this folder will be useless. And keeping them may clutter up your rule list and even cause some unknown errors. Thus, it is suggested to disable them. Here we will expose a piece of VBA code, which will be able to accomplish it in quick time.

Quickly Disable All Rules Related to a Specific Folder in Outlook

Quickly Disable All Rules Related to a Specific Folder

  1. At the very outset, launch your Outlook application.
  2. Then press “Alt + F11” key buttons in main Outlook window.
  3. Next you will get into Outlook VBA editor window. Now you should open an empty module.
  4. Subsequently, copy the following VBA code into this module window.
Sub DisableRulesRelatedtoSpecificFolder()
    Dim objRules As Outlook.Rules
    Dim objRule As Outlook.Rule
    Dim objRuleAction As Outlook.RuleAction
    Dim objRuleFolder As Outlook.Folder
    Dim objSpecificFolder As Outlook.Folder
    Dim strRuleInfo As String
 
    Set objSpecificFolder = Outlook.Application.Session.PickFolder
    'Get all rules in your Outlook
    Set objRules = Outlook.Application.Session.DefaultStore.GetRules
 
    For Each objRule In objRules
        For Each objRuleAction In objRule.Actions
            'Find the rules related to "Copy/Move" to a folder
            If (objRuleAction.ActionType = olRuleActionCopyToFolder) Or (objRuleAction.ActionType = olRuleActionMoveToFolder) Then
               'Restrict to enabled rules
               If objRuleAction.Enabled = True Then
                  'Find the rules related to a specific folder
                  Set objRuleFolder = objRuleAction.Folder
                  If objRuleFolder = objSpecificFolder Then
 
                     strRuleInfo = strRuleInfo & objRule.Name & vbCrLf
 
                     'Disable such rule
                     If strRuleInfo <> "" Then
                        objRule.Enabled = False
                        objRules.Save
                     End If
                  End If
               End If
             End If
        Next
    Next
 
    If strRuleInfo = "" Then
       strMsg = "No rule is related to this folder."
       nPrompt = MsgBox(strMsg, vbOKOnly + vbInformation, "Check Rules")
    End If
End Sub

VBA Code - Disable All Rules Related to a Specific Folder

  1. After that, you need to change your Outlook macro security level to low.
  2. Finally, to trigger the new macro, you can press F5 key button in this macro.
  3. Then you will be required to select a specific folder.
  4. After the macro completes, you can check your rules and will see that all the rules related to a specific folder have been disabled.
  5. If there is no rule involved with the specified folder, you’ll get a message, like the following image:Message for no rule involved with the specified folder

Tricks for Averting PST Data Loss

As Outlook is error prone, you must have ever encountered a variety of errors in your Outlook. For those small problems, restarting Outlook or simply running the Scanpst, the inbox repair tool, will resolve them easily. But for the severe issues, it is necessary to take recourse to a more powerful repair tool, such as DataNumen Outlook Repair.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including mdf fix and outlook repair software products. For more information visit www.datanumen.com

One response to “How to Quickly Disable All Rules Related to a Specific Folder in Outlook”