使用 .Vbs 文件打开默认电子邮件客户端 [英] Open Default E-mail Client using .Vbs file

查看:46
本文介绍了使用 .Vbs 文件打开默认电子邮件客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
通过 VBA 发送电子邮件
在 Exchange 环境中从 Excel 发送电子邮件

到目前为止我有这个

Dim objOutl
Set objOutl = CreateObject("Outlook.Application")
Set objMailItem = objOutl.CreateItem(olMailItem)
objMailItem.Display
strEmailAddr  = "me.me@you.com"
objMailItem.Recipients.Add strEmailAddr
objMailItem.Body = "Hi"
objMailItem.Attachments.Add "access.xml"
Set objMailItem = nothing
Set objOutl = nothing

它有效!但仅限于装有 Outlook 的计算机.我如何才能在装有 Windows Live 的计算机上使用它?

It works! But only on computers that have Outlook. How can I get this to work with computers that have Windows Live?

推荐答案

Windows Live Mail (WLM) 不支持通过 VBA 实现的自动化,因此它不像 Outlook 那样简单.

Windows Live Mail (WLM) doesn't support automation via VBA, so it isn't as straightforward as with Outlook.

对于其他选项,请尝试在搜索字段中输入 [vba] 电子邮件.你会得到不少点击;这是一个相关示例:Hithit命中.其中一些为您提供了使用 CDO 发送邮件的工作代码.如果我是你,这就是我会做的.

For other options, try typing [vba] e-mail in the search field. You'll get quite a few hits; here is a relevant sample: Hit, hit, hit. Some of these give you working code for sending mail using CDO. This is what I would do if I were you.

如果您必须使用 WLM,请查看 这个用于 Excel 的邮件插件,它支持 WLM.

If you must use WLM, then have a look at this mail add-ins for Excel which does support WLM.

否则,您将无法使用 VBA 的 SendMail 方法,该方法非常有限:

Otherwise you're stuck using VBA's SendMail method, which is very limited:

  • 只能发送 Excel 对象,例如工作表、工作簿、图表、范围等.
  • 无法在电子邮件正文中写入文本
  • 不能使用抄送或密件抄送字段
  • 无法附加文件(调用该方法的 Excel 对象除外)

示例代码:

Dim wb As Workbook
Set wb = ActiveWorkbook
wb.SendMail "me.me@you.com", _
            "Insert subject here"

更多示例请看这里:http://www.rondebruin.nl/sendmail.htm

这篇关于使用 .Vbs 文件打开默认电子邮件客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆