Hello all
I have piece of code which when activate moves all my emails into the emails folders where the rules have been set up
This works great but is there a way to not move any emails that I have RED flagged as I don't want to lose sight of these until they have been actioned
I have piece of code which when activate moves all my emails into the emails folders where the rules have been set up
This works great but is there a way to not move any emails that I have RED flagged as I don't want to lose sight of these until they have been actioned
Code:
Sub RunAllInboxRules()
Dim st As Outlook.Store
Dim myRules As Outlook.Rules
Dim rl As Outlook.Rule
Dim count As Integer
Dim ruleList As String
'On Error Resume Next' get default store (where rules live)
Set st = Application.Session.DefaultStore
' get rules
Set myRules = st.GetRules
'iterate all the rules
For Each rl In myRules
' determine if it's an Inbox rule
If rl.RuleType = olRuleReceive Then
' if so, run it
rl.Execute ShowProgress:=True
count = count + 1
ruleList = ruleList & vbCrLf & rl.Name
End If
Next
'tell the user what you did
'ruleList = "These rules were executed against the Inbox: " & vbCrLf & ruleList
MsgBox ruleList, vbInformation, "Macro: RunAllInboxRules"
Set rl = Nothing
Set st = Nothing
Set myRules = Nothing
End Sub