Link to home
Start Free TrialLog in
Avatar of deshaw
deshawFlag for India

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->Advanced 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.
Avatar of debuggerau
debuggerau
Flag of Australia image

Are you trying to overload the send function so you can display a message box?

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..



Avatar of David Lee
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.
Avatar of deshaw

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.
ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of deshaw

ASKER

Thanks BlueDevilFan
You're welcome!
Avatar of deshaw

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.