Partager via


Forward Method

Executes the Forward action for an item. Returns the resulting copy as a new object (as a MeetingItem object for the MeetingItem object or a **MailItem**object for all other objects in the Applies To list).

expression**.Forward**

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

Example

This Visual Basic for Applications (VBA) example uses the Remove method to remove all attachments from a forwarded message before sending it on to Dan Wilson. To run this example, replace 'Dan Wilson' with a valid recipient name and keep a mail item that contains at least one attachment open in the active window.

Sub RemoveAttachmentBeforeForwarding()
    Dim myolApp As Outlook.Application
    Dim myinspector As Outlook.Inspector
    Dim myItem As Outlook.MailItem
    Dim myattachments As Outlook.Attachments
    Set myolApp = CreateObject("Outlook.Application")
    Set myinspector = myolApp.ActiveInspector
    If Not TypeName(myinspector) = "Nothing" Then
        Set myItem = myinspector.CurrentItem.Forward
        Set myattachments = myItem.Attachments
        While myattachments.Count > 0
               myattachments.Remove 1
        Wend
        myItem.Display
        myItem.Recipients.Add "Dan Wilson"
        myItem.Send
    Else
        MsgBox "There is no active inspector."
    End If
End Sub

Applies to | JournalItem Object | MailItem Object | MeetingItem Object | PostItem Object