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

Community Additions

ADD
Show:
© 2014 Microsoft