I have a rule launching a VBA macro in Outlook (Office 365). The macro is activated when an email arrives on one of the Exchange accounts configured in the profile. It is used to sort the email that has arrived.
Sometimes the rule crashes. The On Error
does not catch the error.
An alert popup appears saying:
Unexpected error
It seems that the macro doesn't run in that case.
If in the rule I insert the condition "interrupt the other rules", then it remains active otherwise it is deactivated automatically.
The code under ThisOutlookSession.cls:
Public Sub MySort(Item As Object)
Dim Msg As Outlook.MailItem
On Error GoTo ErrorHandler:
If TypeName(Item) = "MailItem" Then
MyMove Item
End If
ErrorHandler:
Err = 0
Exit Sub
End Sub
Sub MyMove(ele As Object)
[...]
ele.Move
[...]
End Sub
I noticed in rules and alerts management I no longer see my macro in the scripts.