ItemSend Event

Microsoft Outlook Visual Basic

ItemSend Event

       

Occurs whenever an item is sent, either by the user through an Inspector (before the inspector is closed, but after the user clicks the Send button) or when the Send method is used in a program. This event is not available in VBScript.

Sub object_ItemSend(ByVal Item As Object, Cancel As Boolean)

object   An expression that evaluates to an Application object.

Item   Required. The item being sent.

Cancel   Optional. False when the event occurs. If the event procedure sets this argument to True, the send action is not completed and the inspector is left open.

Example

The following example shows how to cancel the ItemSend event in response to user input.

Private Sub myOlApp_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Prompt$ = "Are you sure you want to send " & Item.Subject & "?"
    If MsgBox(Prompt$, vbYesNo + vbQuestion, "Sample") = vbNo Then
        Cancel = True
    End If
End Sub