Office VBA教程:MsoEnvelope对象


提供直接从 Microsoft Office 应用程序以邮件发送文档的功能。

使用 MsoEnvelope对象

使用 Document对象、Chart对象或 Worksheet对象(取决于使用的应用程序)的 MailEnvelope属性返回一个 MsoEnvelope对象。

本示例将活动的 Microsoft Word 文档以电子邮件发送到传递给子例程的电子邮件地址。

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.
        End With
    End With
End Sub

上页:Office VBA教程:LanguageSettings对象 下页:Office VBA教程:NewFile对象

Office VBA教程:MsoEnvelope对象

Office VBA教程:NewFile对象 Office VBA教程:ODSOColumn对象
Office VBA教程:ODSOColumns对象 Office VBA教程:ODSOFilter对象
Office VBA教程:ODSOFilters对象 Office VBA教程:OfficeDataSourceObject对象
Office VBA教程:PropertyTest对象 Office VBA教程:PropertyTests集合对象
Office VBA教程:ScopeFolder对象 Office VBA教程:ScopeFolders集合
Office VBA教程:Script对象 Office VBA教程:Scripts集合对象
Office VBA教程:SearchFolders集合 Office VBA教程:SearchScope对象
Office VBA教程:SearchScopes集合 Office VBA教程:Signature对象
Office VBA教程:SignatureSet集合 Office VBA教程:WebPageFont对象
Office VBA教程:WebPageFonts集合对象 Office VBA教程:New对象
版权所有 © 中山市飞娥软件工作室 证书:粤ICP备09170368号