Execute Method Example

This Visual Basic for Applications example uses the Execute method to look through all the actions for the given mail message, and executes the action called "Reply to All."

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNameSpace("MAPI")
On Error GoTo ErrorHandler
Set myItem = myOlApp.ActiveInspector.CurrentItem
For Each a In myItem.Actions
    If a.Name = "Reply to All" Then
        Set myItem2 = a.Execute
        Exit For
    End If
Next a
Exit Sub
ErrorHandler:
    MsgBox "There is no current item!"