title | keywords | f1_keywords | api_name | ms.assetid | ms.date | ms.localizationpriority | ||
---|---|---|---|---|---|---|---|---|
Application.ItemSend event (Outlook) |
vbaol11.chm429 |
|
|
54f506ea-87a2-29b9-2b33-67bc87167933 |
06/08/2017 |
medium |
Occurs whenever an Microsoft Outlook 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 for an Outlook item, such as MailItem, is used in a program.
expression. ItemSend
( _Item_
, _Cancel_
)
expression A variable that represents an Application object.
Name | Required/Optional | Data type | Description |
---|---|---|---|
Item | Required | Object | The item being sent. |
Cancel | Required | Boolean | 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. |
This event is not available in Microsoft Visual Basic Scripting Edition (VBScript).
The following Microsoft Visual Basic for Applications (VBA) example shows how to cancel the ItemSend event in response to user input. The sample code must be placed in a class module, and the Initialize_handler
routine must be called before the event procedure can be called by Outlook.
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
[!includeSupport and feedback]