共用方式為


Outlook) (Action.Execute 方法

會執行指定之項目的動作。

語法

expressionExecute

表達 會傳回 Action 物件的運算式。

傳回值

Object值,表示動作在執行時所建立的 Outlook 專案。

範例

這個 Visual Basic for Applications (VBA) 範例會使用 Execute 方法來查看指定電子郵件訊息的所有動作,並執行稱為「回復」的動作。

Sub SendReply() 
 
 Dim myNameSpace As Outlook.NameSpace 
 
 Dim MyItem As Outlook.MailItem 
 
 Dim myItem2 As Outlook.MailItem 
 
 Dim myAction As Outlook.Action 
 
 
 
 Set myNameSpace = Application.GetNamespace("MAPI") 
 
 On Error GoTo ErrorHandler 
 
 Set MyItem = Application.ActiveInspector.CurrentItem 
 
 For Each myAction In MyItem.Actions 
 
 If myAction.Name = "Reply" Then 
 
 Set myItem2 = myAction.Execute 
 
 myItem2.Send 
 
 Exit For 
 
 End If 
 
 Next myAction 
 
 Exit Sub 
 
ErrorHandler: 
 
 MsgBox "There is no current item." 
 
End Sub

另請參閱

Action 物件

支援和意見反應

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