Objeto MsoEnvelope

Microsoft Office Objects

Objeto MsoEnvelope

         
MsoEnvelope CommandBars

Proporciona acceso a funciones que le permiten enviar documentos como correos electrónicos directamente desde aplicaciones de Microsoft Office.

Utilizar el objeto MsoEnvelope

Utilice la propiedad MailEnvelope de los objetos Document, Chart o Worksheet, según la aplicación que esté utilizando, para devolver un objeto MsoEnvelope.

El ejemplo siguiente envía el documento activo de Microsoft Word como un correo electrónico a la dirección de correo electrónico que pase a la subrutina.

Sub SendMail(ByVal strRecipient As String)

    'Use a With...End With block to reference the MsoEnvelope object.
    With Application.ActiveDocument.MailEnvelope

        'Add some introductory text before the body of the e-mail.
        .Introduction = "Please read this and send me your comments."

        'Return a Microsoft Outlook MailItem object that
        'you can use to send the document.
        With .Item

            'All of the mail item settings are saved with the document.
            'When you add a recipient to the Recipients collection
            'or change other properties, these settings will persist.
            .Recipients.Add strRecipient
            .Subject = "Here is the document."

            'The body of this message will be
            'the content of the active document.
            .Send
        End With
    End With
End Sub