Automation error running VB macro code

Status
Not open for further replies.

Big Red

Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server 2010
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
 

Big Red

Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server 2010
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
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?
 

Big Red

Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server 2010
I've stepped through all the lines and did not encounter any problems.
 

Big Red

Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server 2010
No. If I try to run the code as a whole it still keeps failing with an automation error.
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Maybe a DoEvents before the Next line will be helpful.
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
M Subject Line Automation - Trigger Script Delayed Outlook VBA and Custom Forms 2
T Outlook Prf/Automation question Using Outlook 2
T Programatic execution of New-MailboxSearch using PSObject (System.Management.Automation) fails with 'Unable to execute the task. Reason: The task Exchange Server Administration 2
J Message automation: message size growth Outlook VBA and Custom Forms 2
D Outlook2007 Email problem with automation Outlook VBA and Custom Forms 4
J Security Restriction Seriously Hampers Outlook Automation Outlook VBA and Custom Forms 1
X Access Outlook Contact Groups with Automation? Outlook VBA and Custom Forms 3
J Adding a background image to a mail item using automation Outlook VBA and Custom Forms 2
V Date and/or time error in Outlook Form Outlook VBA and Custom Forms 0
A Run-time error '430' on certain emails when trying to set "Outlook.mailitem" as "ActiveExplorer.Selection.Item" Outlook VBA and Custom Forms 2
E Complite error on SaveAsFile method Outlook VBA and Custom Forms 3
I Error saving screenshots in a custom form in outlook 2016, outlook 365 - ok in outlook 2013, outlook 2010 Outlook VBA and Custom Forms 5
D Outlook VBA error extracting property data from GetRules collection Outlook VBA and Custom Forms 10
A Unable to save recurring Meeting to Documents folder due to error Using Outlook 2
M Compile error: User-defined type not defined Outlook VBA and Custom Forms 0
R Error when trying to forward current email item Outlook VBA and Custom Forms 7
M ERROR: None of your email accounts could send to this recipient Using Outlook 2
J OLADD.FAE Error When Exporting Contacts Using Outlook 6
C Send/receive error 80040119 Using Outlook 2
W error with the permission for the file Outlook VBA and Custom Forms 0
L Outlook 2019 MAC sync error after working for 4 hours Using Outlook 1
A Run time error 424. object required in outlook 2013 Outlook VBA and Custom Forms 10
M error code 0x8DE00006 Using Outlook 1
M Desktop Version Of Outlook Generating Error Using Outlook 4
M Send/Receive error 0x800CCC0F Using Outlook 0
T Outlook 2016 CSV Translator Import Error Using Outlook 6
ManaarZakaria I'm afraid of this issue, cause of strange error Exchange Server Administration 2
P Suppress dialog box on email check error? Using Outlook 5
vodkasoda Object could not be found Error in Outlook 2007 Outlook VBA and Custom Forms 5
S VBA Macro - Run-time error '424': object required - Help Please Outlook VBA and Custom Forms 3
avant-guvnor Outlook.Application now produces error Outlook VBA and Custom Forms 5
P Run Time Error 91 when linking contact to task in VBA Outlook VBA and Custom Forms 1
N Error 0x80090326 when trying to setup IMAP account on Outlook.com Using Outlook.com accounts in Outlook 1
N Saving And Deleting Outlook Attachments with Unknown Error Message Outlook VBA and Custom Forms 1
Dennis Gaudenzi Your setup couldn't be started because of an unexpected error (mapi 0x80040604) Using Outlook 14
M Outlook 2013 fails to start -- missing WindowsCodecs.dll error Using Outlook 3
Steshelter ICloud Unexpected Error Using Outlook 5
Rupert Dragwater "there was an error reading this theme" Using Outlook 3
A Error: The name cannot be matched to a name in the address list Using Outlook.com accounts in Outlook 0
S Error using AddressEntry.GetContact - need help Outlook VBA and Custom Forms 2
J Outlook - 2013 - Error msg when copying folders from Online Archives to another user's mailbox Using Outlook 0
Vijay Error in rule- Run a script Using Outlook 1
J Object Variable or With Block Not Set Error in Outlook 2016 and not Outlook 2013 Outlook VBA and Custom Forms 3
R Macro to copy email to excel - Runtime Error 91 Object Variable Not Set Outlook VBA and Custom Forms 11
Diane Poremsky The Attachment Size Exceeds the Allowable Limit Error New Slipstick.com Articles 0
Diane Poremsky RMS Error: System clock has been tampered with New Slipstick.com Articles 0
Diane Poremsky Error Opening Outlook and Control Panel's Mail Applet New Slipstick.com Articles 0
K Error: Paper Size Invalid Using Outlook 0
M Error 0x 800CCC92 Using Outlook 0
Diane Poremsky Cannot start Microsoft Office Outlook Error Message New Slipstick.com Articles 0
Similar threads


















































Top