none
ItemSend Event RRS feed

  • Question

  • Hey there, 

    How can I capture the ItemSend event?

    When the user clicks send.

    Is there anyway to stop a mail too?

    Friday, December 11, 2015 5:00 PM

Answers

  • Hello Darryl,

    The ItemSend event of the Aplication class allows to cancel the action by setting the Cancel parameter to true. If the event handler procedure sets this argument to true, the send action is not completed and the inspector is left open.

    Public WithEvents myOlApp As Outlook.Application  
     
     
    Public Sub Initialize_handler()  
     Set myOlApp = Outlook.Application  
    End Sub  
      
    Private Sub myOlApp_ItemSend(ByVal Item As Object, Cancel As Boolean)  
     Dim prompt As String  
     prompt = "Are you sure you want to send " & Item.Subject & "?"  
     If MsgBox(prompt, vbYesNo + vbQuestion, "Sample") = vbNo Then  
     Cancel = True  
     End If  
    End Sub

    Friday, December 11, 2015 5:31 PM