Muokkaa

Jaa


MailItem.Actions property (Outlook)

Returns an Actions collection that represents all the available actions for the item. Read-only.

Syntax

expression. Actions

expression A variable that represents a MailItem object.

Example

This Visual Basic for Applications (VBA) example creates a new mail item and uses the Actions.Add method to add an Action to it. Then it sends the mail item to the current user. The mail item received will have the Agree action in addition to the standard actions such as Reply and Reply All.

Sub AddAction() 
 
 Dim myItem As Outlook.MailItem 
 
 Dim myAction As Outlook.Action 
 
 
 
 Set myItem = Application.CreateItem(olMailItem) 
 
 Set myAction = myItem.Actions.Add 
 
 myAction.Name = "Agree" 
 
 myItem.To = Application.GetNamespace("MAPI").CurrentUser 
 
 myItem.Send 
 
End Sub

The following Visual Basic for Applications example creates a new mail item and uses the Actions.Add method to add an Action called Link Original to it. Executing this action will insert a link to the original mail item.

Sub AddAction2() 
 
 Dim myItem As Outlook.MailItem 
 
 Dim myAction As Outlook.Action 
 
 Set myItem = Application.CreateItem(olMailItem) 
 
 Set myAction = myItem.Actions.Add 
 
 
 
 myAction.Name = "Link Original" 
 
 myAction.ShowOn = olMenuAndToolbar 
 
 myAction.ReplyStyle = olLinkOriginalItem 
 
 myItem.To = "Dan Wilson" 
 
 myItem.Send 
 
End Sub

See also

MailItem 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.