Forward Event

Occurs when the user selects the Forward action for a Microsoft Outlook item.

Subobject**_Forward(ByVal Forward As Object, Cancel As Boolean)**

*object   * An expression that evaluates to one of the objects in the Applies To list. In Microsoft Visual Basic Scripting Edition (VBScript), use the word Item.

Forward The new item being forwarded.

Cancel Optional (not used in VBScript). False when the event occurs. If the event procedure sets this argument to True, the forward operation is not completed and the new item is not displayed.


In VBScript, if you set the return value of this function to False, the forward action is not completed and the new item is not displayed.


This Microsoft Visual Basic/Visual Basic for Applications (VBA) example uses the Forward event to disable forwarding on an item that has the subject "Do not forward" by setting the Cancel argument to True and it also displays a message that the item may not be forwarded. The sample code must be placed in a class module such as ThisOutlookSession, and the Initialize_Handler() routine should be called before the event procedure can be called by Microsoft Outlook. A e-mail item must be open when you run Initialize_Handler().

Public WithEvents myItem As Outlook.MailItem

Public Sub Initialize_Handler()
    Set myItem = Application.ActiveInspector.CurrentItem
End Sub

Private Sub myItem_Forward(ByVal Forward As Object, Cancel As Boolean)
    If myItem.Subject = "Do not forward" Then
        MsgBox "You may not forward this message!"
        Cancel = True
    End If
End Sub

Applies to | AppointmentItem Object | ContactItem Object | DistListItem Object | DocumentItem Object | JournalItem Object | MailItem Object | MeetingItem Object | PostItem Object | RemoteItem Object | ReportItem Object | TaskItem Object | TaskRequestAcceptItem Object | TaskRequestDeclineItem Object | TaskRequestItem Object | TaskRequestUpdateItem Object

See Also | Close Method | CustomAction Event | CustomPropertyChange Event | Open Event | PropertyChange Event | Read Event | Reply Event | ReplyAll Event | Send Method | Using events with Automation | Write Event