• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Outlook 2013 Automation error running VB macro code

Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server 2010
#1
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
 
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server 2010
#3
Hi Michael,

Thank you for your response. Here is the list of entries checked within VB:

Visual Basic for Applications
Microsoft Outlook 15.0 Object Library
OLE Automation
Microsoft Office 15.0 Object Library
Microsoft Outlook View Control

Kind Regards

Martin
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
#4
Ok, I thought the OLE Automation is missing.

I'd walk through the code execution step by step by pressing f8, and see where it doesn't behave as expected. For instance, which line is executed before the error comes up, is any rule exucted at all?
 
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server 2010
#5
I've stepped through all the lines and did not encounter any problems.
 
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server 2010
#7
No. If I try to run the code as a whole it still keeps failing with an automation error.
 

Similar threads