Last active
May 29, 2017 03:20
-
-
Save stephenchew/a91690e472abd6332e53f27b0c4c65f0 to your computer and use it in GitHub Desktop.
Invoke all Outlook rules with the prefix `[Clean Up]`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Sub CleanUpAll() | |
Dim st As Outlook.Store | |
Dim myRules As Outlook.Rules | |
Dim rl As Outlook.Rule | |
Dim ruleList As String | |
Set st = Application.Session.DefaultStore | |
Set myRules = st.GetRules | |
For Each rl In myRules | |
If rl.RuleType = olRuleReceive Then | |
If InStr(rl.Name, "[Clean up]") > 0 Then | |
rl.Execute ShowProgress:=True | |
ruleList = ruleList & vbCrLf & rl.Name | |
End If | |
End If | |
Next | |
ruleList = "This rule was executed against the Inbox:" & vbCrLf & ruleList | |
MsgBox ruleList, vbInformation, "Clean up inbox" | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment