I have several macros that run various rules or groups of rules the move emails between folders in my Outlook 2013 mailbox. This works fine on my current Windows 7 PC. I am in the process of migrating over to Windows 10 also running Outlook 2013. While migrating the rules I ran into a problem where I am unable to run the macros. Each macro I run produces an automation error:
Run-time error '-2147221233 (8004010f)': Automation error
Here is the sample code I am trying to run:
Sub RunForeFrontRule()
Dim st As Outlook.Store
Dim myRules As Outlook.Rules
Dim rl As Outlook.Rule
Dim runrule As String
Dim rulename As String
Dim cf As Folder
rulename = "Forefront"
Set st = Application.Session.DefaultStore
Set myRules = st.GetRules
Set cf = Application.ActiveExplorer.CurrentFolder
For Each rl In myRules
If rl.RuleType = olRuleReceive Then
If rl.Name = rulename Then
rl.Execute ShowProgress:=True, Folder:=cf
runrule = rl.Name
End If
End If
Next
Set rl = Nothing
Set st = Nothing
Set myRules = Nothing
End Sub
When I try to debug the code it goes straight to the first NEXT and stops. I have been searching high and low trying to find a solution with no luck.
Please help. I am desperate at this point.
Thanks
Run-time error '-2147221233 (8004010f)': Automation error
Here is the sample code I am trying to run:
Sub RunForeFrontRule()
Dim st As Outlook.Store
Dim myRules As Outlook.Rules
Dim rl As Outlook.Rule
Dim runrule As String
Dim rulename As String
Dim cf As Folder
rulename = "Forefront"
Set st = Application.Session.DefaultStore
Set myRules = st.GetRules
Set cf = Application.ActiveExplorer.CurrentFolder
For Each rl In myRules
If rl.RuleType = olRuleReceive Then
If rl.Name = rulename Then
rl.Execute ShowProgress:=True, Folder:=cf
runrule = rl.Name
End If
End If
Next
Set rl = Nothing
Set st = Nothing
Set myRules = Nothing
End Sub
When I try to debug the code it goes straight to the first NEXT and stops. I have been searching high and low trying to find a solution with no luck.
Please help. I am desperate at this point.
Thanks