问题

I would like to do some operation when a new mail comes to mailbox. For that I am using Item_Add() Event
Private Sub myOlItems_ItemAdd(ByVal Item As Object)
... Do Something
Exit Sub
Can anyone tell me How to set the Handler for "inbox" folder under "gilbertojperera@gmail.com"?
Problem:
The issue I am facing here is that this even get fired only when a new mail comes in "Inbox" folder under "Outlook Data File". But I used to receive mails in the other "Inbox" folder marked by second red arrow (third last folder)
Due to this problem My Item_Add() event is not being triggered & resulting to my outlook macro Fail.
Please do help if you have some valuable inputs.
回答1:
It sounds like you only initialized the handler for the Inbox DefaultFolder (olFolderInbox). You also must add a handler to the Inbox folder for gilbertojperera@gmail.com.
来源:https://stackoverflow.com/questions/23593671/issue-with-outlook-event-for-new-mail