Run_All_Inbox_Rules
I used the code below in Windows XP Outlook 2007 with no issues. When I moved to Windows 7 and Outlook 2010, I keep receiving an error.
The error:
run time error '-244055551 (f1740201)':
Automation error
I tried to research the many different web sites, but have not found a solution to my issues. Please assist
big0
Sub A_Run_All_Inbox_Rules()
' Macro Ready Message Box
MsgBox "Ready All Inbox Rules will be executed.", vbCritical
Dim st As Outlook.Store
Dim myRules As Outlook.Rules
'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
' Macro Done Message Box
MsgBox "Rules have been ran succesfull ", vbCritical
Set rl = Nothing
Set st = Nothing
Set myRules = Nothing
End Sub
|