BeforeAttachmentSave Event

Microsoft Outlook Visual Basic

BeforeAttachmentSave Event

       

Occurs just before an attachment is saved.

Sub object_BeforeAttachmentSave(ByVal Attachment As Attachment, Cancel As Boolean)

object   An expression that evaluates to one of the objects in the Applies To list. In VBScript, use the word Item.

Attachment   Required. The Attachment to be saved.

Cancel   Optional (not used in VBScript). False when the event occurs. If the event procedure sets this argument to True, the save operation is not completed and the attachment is not changed.

Remarks

In VBScript, if you set the return value of this function to False, the save operation is cancelled and the attachment is not changed.

Example

This VBScript example notifies the user that the user is not allowed to save the attachment. It returns False to cancel the save operation.

Function Item_BeforeAttachmentSave(ByVal SaveAttachment)
    MsgBox "You are not allowed to save " & SaveAttachment.Name
    Item_BeforeAttachmentSave = False
End Function