EnableSharedAttachments Property

Sets or returns a Boolean that determines whether the Attachment Options task pane will be displayed in the Microsoft Outlook user interface for an e-mail item. Read/write.

expression.EnableSharedAttachments

*expression   * Required. An expression that returns one of the objects in the Applies To list.

Example

The following Microsoft Visual Basic for Applications (VBA) example hides the Attachment Options task pane when an attachment is added to an e-mail item. The sample code must be placed in a class module such as ThisOutlookSession, and the TestAttachRead() procedure should be called before the event procedure can be called by Outlook. For this example to run without errors, a file called Test.txt should exist in the C:\ folder.

  Public WithEvents newItem As Outlook.MailItem

Private Sub newItem_AttachmentAdd(ByVal newAttachment As Attachment)
   newItem.EnableSharedAttachments = False
   newItem.Display
End Sub

Public Sub TestAttachAdd()
    Dim olApp As New Outlook.Application
    Dim atts As Outlook.Attachments
    Dim newAttachment As Outlook.Attachment

    Set newItem = olApp.CreateItem(olMailItem)
    newItem.Subject = "Test attachment"
    Set atts = newItem.Attachments
    Set newAttachment = atts.Add("C:\Test.txt", olByValue)
End Sub