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

编程入门 行业动态 更新时间:2024-10-27 10:31:43
本文介绍了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:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/591041.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:发送电子邮件   Access   MS   Outlook   VBA

发布评论

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

>www.elefans.com

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