Outlook) (MailItem.Forward 方法

執行項目的 [轉寄 ] 動作,並將產生的複本作為 MailItem 物件傳回。

語法

expression。 Forward

運算式 代表 MailItem 物件的變數。

傳回值

MailItem 物件,代表新的郵件項目。

範例

此 Visual Basic for Applications (VBA) 範例使用 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

另請參閱

MailItem 物件

支援和意見反應

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