【问题标题】:How to Disable All Rules?如何禁用所有规则?
【发布时间】:2020-01-25 01:27:46
【问题描述】:

我在 Outlook 365 中收到以下行的错误:

Set colRules = Application.Session.DefaultStore.GetRules

在禁用我的 Outlook 规则的代码中。

“运行时错误:一个或多个规则存在冲突。您必须先解决冲突,然后才能保存规则。”

Sub DisableAllRules()
Dim colRules As Outlook.Rules
Dim oRule As Outlook.Rule
Dim count As Integer
Dim ruleList As String
'On Error Resume Next

'Get Rules from Session.DefaultStore object
Set colRules = Application.Session.DefaultStore.GetRules

' iterate all the rules
For Each oRule In colRules
oRule.Enabled = False
count = count + 1
ruleList = ruleList & vbCrLf & count & ". " & oRule.Name
Next

colRules.Save

'tell the user what you did
ruleList = "These rules were enabled: " & vbCrLf & ruleList
MsgBox ruleList, vbInformation, "Macro: DisableAllRules"

Set colRules = Nothing
Set oRule = Nothing
End Sub

【问题讨论】:

    标签: vba outlook rules disable


    【解决方案1】:

    我遇到了这个问题。我认为这是由 Outlook 不再支持的某些规则引起的,并且在 Outlook 的“规则”菜单中以红色突出显示。我删除了它们,运行时错误消失了。

    【讨论】:

      猜你喜欢
      • 2015-10-07
      • 2018-04-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-17
      • 2018-09-05
      • 2020-01-04
      • 1970-01-01
      相关资源
      最近更新 更多