全部显示

Attachments 对象

         
多个对象
Attachments
多个对象

包含 Attachment 对象的对象,代表 Outlook 项目中的所有附件。

使用 Attachments 对象

使用 Attachments 属性返回任何 Outlook 项目(便笺除外)的 Attachments 集合。

使用 Add 方法将附件添加到项目中。

若要保证结果一致,请始终在项目的 Attachments 集合中添加或删除对象之前保存项目。

以下 Visual Basic for Applications 示例新建一个邮件,将 Q496.xls 作为附件(不是链接)附加,并为附件设置一个描述性标题。

Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
myItem.Save
Set myAttachments = myItem.Attachments
myAttachments.Add "C:\My Documents\Q496.xls", _
    olByValue, 1, "4th Quarter 1996 Results Chart"

使用 Attachments(index) 返回单个 Attachment 对象。其中 index 是索引号。