Outlook) (附件物件

代表文件或是包含在 Outlook 項目中之文件的連結。

註解

使用 [附件 ] (索引) ,其中 index 是索引號碼,以傳回單一 [附件 ] 物件。

使用 Add 方法將附件新增至項目。

範例

下列 Visual Basic for Applications (VBA) 範例會建立新郵件、附加 Q496.xlsx 做為附件 (而非連結)、為附件指定一個描述性的標題,以及顯示郵件及附件。 此範例假設指定的試算表 Q496.xlsx 已在指定的路徑 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

另請參閱

將檔案附加至 [郵件] 項目將 Outlook 連絡人項目附加至 Email 訊息限制 Outlook Email 訊息的附件大小 修改 Outlook Email 的附件Outlook 物件模型參考

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。