Muokkaa

Jaa


Action.Execute method (Outlook)

Executes the action for the specified item.

Syntax

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.

Example

This Visual Basic for Applications (VBA) example uses the Execute method to look through all the actions for the given email 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

See also

Action Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.