편집

다음을 통해 공유


Attachment object (Outlook)

Represents a document or link to a document contained in an Outlook item.

Remarks

Use Attachments (index), where index is the index number, to return a single Attachment object.

Use the Add method to add an attachment to an item.

Example

The following Visual Basic for Applications (VBA) example creates a new mail message, attaches Q496.xlsx as an attachment (not a link), assigns the attachment a descriptive caption, and displays the mail message with this attachment. This example assumes that the specified spreadsheet, Q496.xlsx, exists in the specified path, D:\Documents.

Sub AddAttachment() 
 
 Dim myItem As Outlook.MailItem 
 
 Dim myAttachments As Outlook.Attachments 
 
 
 
 Set myItem = Application.CreateItem(olMailItem) 
 
 Set myAttachments = myItem.Attachments 
 
 myAttachments.Add "D:\Documents\Q496.xlsx", _ 
 
 olByValue, 1, "4th Quarter 1996 Results Chart" 
 
 myItem.Display 
 
End Sub

See also

Attach a File to a Mail Item Attach an Outlook Contact Item to an Email Message Limit the Size of an Attachment to an Outlook Email Message Modify an Attachment of an Outlook Email Message Outlook Object Model Reference

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.