MS Access VBA:通过 Outlook 发送电子邮件

编程入门 行业动态 更新时间:2024-10-27 08:29:40
本文介绍了MS Access VBA:通过 Outlook 发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何使用 MS Access VBA 通过帐户发送电子邮件?我知道这个问题很模糊,但很难在网上找到不以某种方式过时的相关信息.

How can I send an email through an account using MS Access VBA? I know this question is vague but it's so hard to find the relevant information online that isn't outdated in some way.

我并不是要对那些回答的人无礼,但是我使用的是 MS Access.我无法在 Outlook VBA 中编写实际代码.

I don't mean to be rude to those who are answering, but I am using MS Access. I cannot write the actual code in Outlook VBA.

推荐答案

在 Visual Basic 编辑器中添加对 Outlook 对象模型的引用.然后您可以使用下面的代码使用 Outlook 发送电子邮件.

Add a reference to the Outlook object model in the Visual Basic editor. Then you can use the code below to send an email using outlook.

Sub sendOutlookEmail() Dim oApp As Outlook.Application Dim oMail As MailItem Set oApp = CreateObject("Outlook.application") Set oMail = oApp.CreateItem(olMailItem) oMail.Body = "Body of the email" oMail.Subject = "Test Subject" oMail.To = "Someone@somewhere" oMail.Send Set oMail = Nothing Set oApp = Nothing End Sub

更多推荐

MS Access VBA:通过 Outlook 发送电子邮件

本文发布于:2023-06-08 23:38:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/591038.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:发送电子邮件   Access   MS   Outlook   VBA

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!