This documentation is archived and is not being maintained.

Action.Execute Method (Outlook)

Executes the action for the specified item.

expression .Execute

expression An expression that returns a Action object.

Return Value

An Object value that represents the Outlook item created by the action upon execution.

This Visual Basic for Applications (VBA) example uses the Execute method to look through all the actions for the given e-mail message and executes the action called "Reply."

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 
 Exit For 
 End If 
 Next myAction 
 Exit Sub 
 MsgBox "There is no current item." 
End Sub