Office) (MsoEnvelope 对象

提供对可直接从 Microsoft Office 应用程序以电子邮件形式发送文档的功能的访问权限。

备注

使用文档对象、图表对象或工作表对象的 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 email. 
 .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 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

另请参阅

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。