Actions Property

Microsoft Outlook Visual Basic

Returns an Actions collection that represents all the available actions for the Outlook item.

expression.Actions

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

This Visual Basic for Applications (VBA) example creates a new mail item and uses the 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 myolApp As New Outlook.Application
	Dim myItem As Outlook.MailItem
	Dim myAction As Outlook.Action
	Set myItem = myOlApp.CreateItem(olMailItem)
	Set myAction = myItem.Actions.Add
	myAction.Name = "Agree"
	myItem.To = myolApp.GetNamespace("MAPI").CurrentUser
	myItem.Send
End Sub
		

The following Visual Basic for Applications example creates a new mail item and uses the 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 myOlApp As New Outlook.Application
 Dim myItem As Outlook.MailItem
 Dim myAction As Outlook.Action
 Set myItem = myOlApp.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
				

If you use Microsoft Visual Basic Scripting Edition (VBScript) in a Microsoft Outlook form, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript.

Set myItem = Application.CreateItem(0)
Set myAction = myItem.Actions.Add
 myAction.Name = "Link Original"
 myAction.ShowOn = 2
 myAction.ReplyStyle = 4
 myItem.To = "Dan Wilson"
 myItem.Send