Düzenle

Aracılığıyla paylaş


MailItem.Send event (Outlook)

Occurs when the user selects the Send action for an item, or when the Send method is called for the item, which is an instance of the parent object.

Syntax

expression. Send( _Cancel_ )

expression A variable that represents a MailItem object.

Parameters

Name Required/Optional Data type Description
Cancel Required Boolean (Not used in VBScript). False when the event occurs. If the event procedure sets this argument to True, the send operation is not completed and the inspector is left open.

Remarks

In Microsoft Visual Basic Scripting Edition (VBScript), if you set the return value of this function to False, the item is not sent.

Example

This Visual Basic for Applications (VBA) example uses the Send event and sends an item with an automatic expiration date. The sample code must be placed in a class module such as ThisOutlookSession, and the SendMyMail procedure must be called before the event procedure can be called by Microsoft Outlook.

Public WithEvents myItem As Outlook.MailItem 
 
 
 
Sub SendMyMail() 
 
 Set myItem = Outlook.CreateItem(olMailItem) 
 
 myItem.To = "Dan Wilson" 
 
 myItem.Subject = "Data files information" 
 
 myItem.Send 
 
End Sub 
 
 
 
Private Sub myItem_Send(Cancel As Boolean) 
 
 myItem.ExpiryTime = #2/2/2003 4:00:00 PM# 
 
End Sub

See also

MailItem Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.