How to Batch Disable All Outlook Rules Related to a Specific Contact

For some reasons, you may want to batch disable all rules that are involved with a specific contact. Instead of doing it manually, you can use the method shared in this article.

For example, you intend to delete a contact from your Outlook. Thus, you want to delete all the existing options or objects related to this contact, such as the rules. In general, you have to first open the “Rules and Alerts” dialog box, then find such rules and disable them one by one. You may feel that it’s too troublesome. Hence, here we will show you a quick solution to get it.

How to Batch Disable All Outlook Rules Related to a Specific Contact

Batch Disable All Rules Related to a Specific Contact

  1. To begin with, access Outlook VBA editor.
  2. Then, paste the following VBA code into an empty module.
Sub DisableAllRulesRelatedtoSpecificContact()
    Dim objContact As Outlook.ContactItem
    Dim objRules As Outlook.Rules
    Dim i As Long
    Dim objRule As Outlook.Rule
    Dim objRuleCondition As Outlook.RuleCondition
    Dim objToFromCondition As Outlook.ToOrFromRuleCondition
    Dim objRuleRecipients As Outlook.Recipients
    Dim objRuleRecipient As Outlook.Recipient
    Dim strRuleRecipients As String
    Dim lRuleCount As Long
    'Get the selected contact
    Set objContact = Outlook.Application.ActiveExplorer.Selection.Item(1)
    If Not objContact Is Nothing Then
       Set objRules = Outlook.Application.Session.DefaultStore.GetRules
       lRuleCount = 0
       'Find the rules related to the specific contact
       For i = objRules.Count To 1 Step -1
           Set objRule = objRules(i)
           For Each objRuleCondition In objRule.Conditions
               If (objRuleCondition.ConditionType = olConditionFrom) Or (objRuleCondition.ConditionType = olConditionSentTo) Then
                  Set objToFromCondition = objRuleCondition
                  Set objRuleRecipients = objToFromCondition.Recipients
                  For Each objRuleRecipient In objRuleRecipients
                      strRuleRecipients = objRuleRecipient.Address & ";" & strRuleRecipients
                  'Disable the rules
                  If InStr(strRuleRecipients, objContact.Email1Address) > 0 Then
                     If objRule.Enabled = True Then
                        lRuleCount = lRuleCount + 1
                        objRule.Enabled = False
                     End If
                  End If
            End If
      MsgBox lRuleCount & " rules related to " & objContact.FullName & " are disabled.", vbInformation + vbOKOnly
    End If
End Sub

VBA Code - Batch Disable All Rules Related to a Specific Contact

  1. After that, add the macro to Quick Access Toolbar by referring to the article – “How to Run VBA Code in Your Outlook“.
  2. Eventually, you can have a try.
  • First off, select a contact.
  • Then, click the macro button in Quick Access Toolbar.Run Macro on Selected Contact
  • When macro finishes, you will get a message like the following image.Prompt about Results
  • At present, you can check your Outlook rules. All the rules related to the specific contact have been disabled.Disabled Rules

Tackle Outlook Problems with Ease

Given Outlook’s vulnerabilities, you may look forward to learning some effective means to deal with Outlook problems. First of all, you need to make the following preparations. For instance, you need to make regular data backup for Outlook. In addition, it is wise and prudent to prepare an experienced and reliable PST repair tool, like DataNumen Outlook Repair. It is able to fix Outlook issues that involves PST file within minutes.

Author Introduction:

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

Comments are closed.