I have (using information from SO) implemented a VBA macro that runs to process new emails after the 'run a script' options was removed from the Outlook rules. I do this as follows:
Private WithEvents Items As Outlook.Items
Public Sub Application_Startup()
' Add an inbox event listener
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Set olApp = Outlook.Application
Set objNS = olApp.GetNamespace("MAPI")
' default local Inbox
Set Items = objNS.GetDefaultFolder(olFolderInbox).Items
MsgBox "Startup macro run"
End Sub
Private Sub Items_ItemAdd(ByVal item As Object)
'Do something on new email arrival
.
.
.
End Sub
However the inbox listener appears to frequently stop working and I either have to restart Outlook or re-run the 'Startup' macro manually to kick it back into life - this appears to be a common problem with no solution.
Question - I'm not a VBA expert and I was wondering if I can I simply re-run the 'Application_Startup' macro to restart the listener at the end of the 'Items_ItemAdd(ByVal item As Object)'
macro?