傳回一個 附件物件 ,代表指定項目的所有附件。 唯讀。
語法
expression。 Attachments
運算式 代表 MailItem 物件的變數。
範例
此 Visual Basic for Applications (VBA) 範例使用 Attachments.Remove 方法,在將轉寄郵件訊息傳送給 'Dan Wilson' 之前,先移除轉寄郵件訊息中的所有附件。 若要執行此範例,請將 'Dan Wilson' 取代成有效的收件者名稱,並在檢查員視窗中開啟一個具有附件的項目。
Sub RemoveAttachmentBeforeForwarding()
Dim myinspector As Outlook.Inspector
Dim myItem As Outlook.MailItem
Dim myattachments As Outlook.Attachments
Set myinspector = Application.ActiveInspector
If Not TypeName(myinspector) = "Nothing" Then
Set myItem = myinspector.CurrentItem.Forward
Set myattachments = myItem.Attachments
While myattachments.Count > 0
myattachments.Remove 1
Wend
myItem.Display
myItem.Recipients.Add "Dan Wilson"
myItem.Send
Else
MsgBox "There is no active inspector."
End If
End Sub
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。