Question

I am writing an addin to change the signature of composed mails. I tried Private Sub inspectors_NewInspector. This does not work because at the time this is invoked the signature has not been added to the mail, but the mail Body is the mail Body of the original mail I am answering. How can I invoke my code after the signature has been added?

I did try

Private Sub inspectors_activate(ByVal Inspector As Microsoft.Office.Interop.Outlook.Inspector) Handles inspectors.NewInspector

and

Private Sub inspectors_NewInspector(ByVal Inspector As Microsoft.Office.Interop.Outlook.Inspector) Handles inspectors.NewInspector

both fire befor signature is added (I tested that by adding a MsgBox(mailItem.Body) in the Sub, there I can see that the Body is identically to the mail I am answering too.

EDIT The activate - Event seems not to work - I tried:

    Public Sub inspector_activate(ByVal Inspector As Microsoft.Office.Interop.Outlook.Inspector)_
       Handles inspector.activate
        Dim mailItem As Outlook.MailItem = TryCast(Inspector.CurrentItem, Outlook.MailItem)
        Msgbox("test activate has fired")
        If Not TypeOf MailItem Is Outlook.MailItem Then Exit Sub
     end sub

Thanks
Max
Was it helpful?

Solution

Try to use the Inspector.Activate event - it fires after the inspector is visible.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top