deshaw
asked on
Item send event is not getting fired from Outlook COM Add-ins
Hi,
I have written testing Outllok COM Add-in with load behaviour at startup, registered, and verified that it has added in COM Add-ins list in "tools->options->others->A dvanced options->COM Add-ins" and put message box in item send event given below: (I have also added my add-in in refereces from Visual basic Editor).
Private WithEvents objMailItem As Outlook.MailItem
Private Sub objMailItem_Send(Cancel As Boolean)
MsgBox "Item is being sent"
End Sub
Could any one please tell me what is wrong here?
Thanks.
I have written testing Outllok COM Add-in with load behaviour at startup, registered, and verified that it has added in COM Add-ins list in "tools->options->others->A
Private WithEvents objMailItem As Outlook.MailItem
Private Sub objMailItem_Send(Cancel As Boolean)
MsgBox "Item is being sent"
End Sub
Could any one please tell me what is wrong here?
Thanks.
Hi, deshaw.
The code has to initialize the objMailItem variable with a message before the code can work. You'll initialize the variable in a NewInspector event. Look back at the add-in code you downloaded and you'll see how this works.
The code has to initialize the objMailItem variable with a message before the code can work. You'll initialize the variable in a NewInspector event. Look back at the add-in code you downloaded and you'll see how this works.
ASKER
Perfect BlueDevilFan!!! Could you tell me where is Application_NewMailEx and Application_Reminder events in the list in OutAddIn class modules? I couldn't find it. Do I have to create it? If yes please let me know below are the correct prototypes:
Private Sub objMailItem_NewMailEx (Cancel As Boolean)
'
End Sub
Could you help me to dedine Application_Reminder event similar to my macro given below:
Private Sub Application_Reminder(ByVal Item As Object)
Select Case Item.Class
Case olMail
'do task1
Case olAppointment
'do task2
Case olContact
'do task3
Case olTask
'do task4
End Select
End Sub
Thanks for being there.
Private Sub objMailItem_NewMailEx (Cancel As Boolean)
'
End Sub
Could you help me to dedine Application_Reminder event similar to my macro given below:
Private Sub Application_Reminder(ByVal
Select Case Item.Class
Case olMail
'do task1
Case olAppointment
'do task2
Case olContact
'do task3
Case olTask
'do task4
End Select
End Sub
Thanks for being there.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks BlueDevilFan
You're welcome!
ASKER
BlueDevilFan, I just noticed that Application_NewMailEx is not getting called on new mail arrieved. Do I need to set any object for this event as well as we did it in objMailItem_Send?
Thanks.
Thanks.
Unfortunately, you will need to send the mail send command from within your own form, programmed with the messagebox to fire the send event.
So I hope your using clsMailItemTrapper..
Also, have you signed it properly, outlook needs a self signed cert..