The Attachment Read Event

The AttachmentRead event occurs when an attachment in an item has been opened for reading. If the Attachment object is blocked by the Outlook E-Mail Security Update, the AttachmentRead event occurs after the Security Warning dialog box appears. The following example saves a copy of the attachment into the My Documents folder when the user opens that attachment:

Sub ltem_AttachmentRead(ByVal ReadAttachment) Const olByValue = 1

If ReadAttachment.Type = olByValue Then

IntResponse = MsgBox("Save to c:\my documents?", vbQuestion + vbYesNo) If IntResponse = vbYes Then

ReadAttachment.SaveAsFile "c:\my documentsV _ & ReadAttachment.DisplayName End If End If End Sub

0 0

Post a comment