设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 5038|回复: 4
打印 上一主题 下一主题

[求助]如何用VBA实现(Send to>>Mail Recipient)

[复制链接]
跳转到指定楼层
1#
发表于 2006-9-7 20:19:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

Send To>>Mail Recipient
而不是
Send To>>Mail Recipient (as Attachment...)

ThisWorkbook.SendMail() 是按附件方式发送,而我需要的是:收到Mail 后打开MAil Item 即可见Excel的WorkSheet,
Mail Recipient 就可以做到,但我不知道用VBA怎么写。谢谢赐教。




[此贴子已经被作者于2006-9-8 8:53:00编辑过]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2006-9-8 19:58:00 | 只看该作者
这个例子可能对你有用,至少可以参考一下,用OUTLOOK发邮件,密码为当前日期(MMDD格式)。也可以自已修改代码把密码去掉。


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
3#
 楼主| 发表于 2006-9-8 22:35:00 | 只看该作者
多谢方侠。你的例子还是解决不了我的问题。

Excel菜单File>>Send To>>Mail Recipient结果是:打开邮件直接可见到WORKSHEET,没有正文,也没有附件。
4#
发表于 2006-9-9 00:20:00 | 只看该作者
我的是英文2003的,压根就没看见这个菜单呀,是不是取消掉了?

不过可以试试以下这三种方法。

SendMail Method

See AlsoApplies ToExampleSpecificsSends the workbook by using the installed mail system.

expression.SendMail(Recipients, Subject, ReturnReceipt)
expression    Required. An expression that returns a Workbook object.

Recipients    Required Variant. Specifies the name of the recipient as text, or as an array of text strings if there are multiple recipients. At least one recipient must be specified, and all recipients are added as To recipients.

Subject    Optional Variant. Specifies the subject of the message. If this argument is omitted, the document name is used.

ReturnReceipt    Optional Variant. True to request a return receipt. False to not request a return receipt. The default value is False.

Example

This example sends the active workbook to a single recipient.

ActiveWorkbook.SendMail recipients:="Jean Selva"




SendForReview Method


Sends a workbook in an e-mail message for review to the specified recipients.

expression.SendForReview(Recipients, Subject, ShowMessage, IncludeAttachment)

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

Recipients   Optional Variant. A string that lists the people to whom to send the message. These can be unresolved names and aliases in an e-mail phone book or full e-mail addresses. Separate multiple recipients with a semicolon (;). If left blank and ShowMessage is False, you will receive an error message, and the message will not be sent.

Subject   Optional Variant. A string for the subject of the message. If left blank, the subject will be: Please review "filename   ".

ShowMessage   Optional Variant. A Boolean value that indicates whether the message should be displayed when the method is executed. The default value is True. If set to False, the message is automatically sent to the recipients without first showing the message to the sender.

IncludeAttachment   Optional Variant. A Boolean value that indicates whether the message should include an attachment or a link to a server location. The default value is True. If set to False, the document must be stored at a shared location.

Remarks

The SendForReview method starts a collaborative review cycle. Use the EndReview method to end a review cycle.

Example

This example automatically sends the active workbook as an attachment in an e-mail message to the specified recipients.

Sub WebReview()

    ActiveWorkbook.SendForReview _
        Recipients:="someone@microsoft.com; amy jones; lewjudy", _
        Subject:="lease review this document.", _
        ShowMessage:=False, _
        IncludeAttachment:=True

End Sub





MsoEnvelope Object


Provides access to functionality that lets you send documents as emails directly from Microsoft Office applications.

Using the MsoEnvelope object

Use the MailEnvelope property of the Document object, Chart object or Worksheet object (depending on the application you are using) to return a MsoEnvelope object.

The following example sends the active Microsoft Word document as an e-mail to the e-mail address that you pass to the subroutine.

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 = "lease 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 collectio
5#
 楼主| 发表于 2006-9-9 03:19:00 | 只看该作者
The SendForReview method 这可能是我要的回去试试,谢谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-11-26 03:23 , Processed in 0.107738 second(s), 29 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表