ACCESS 2007 - 在特定事件时使用Outlook自动发送和发送电子邮件 [英] ACCESS 2007 - Automatically Send and Email Using Outlook Upon a Specific Event

查看:291
本文介绍了ACCESS 2007 - 在特定事件时使用Outlook自动发送和发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Microsoft Access 2007中创建一个应用程序。如何在特定事件上使用Outlook 2007静默地发送电子邮件,而无需任何用户交互。我应该如何处理如果你能提供一些VBA,那将是非常好的,但如果没有,你可以指导我如何完成这个吗?

I am trying to create an App in Microsoft Access 2007. How can I silently send an email out using Outlook 2007 upon a specific event without any user interaction. How should I approach this. If you can provide some VBA some it would be extremely nice, but if not, could you guide me in how to accomplish this?

推荐答案

p>我可以使用以下代码解决我的问题:

I was able to solve my problem with the following code:

Public Sub SendEmail()

    Email_Bcc = "email@domain.com"
    Email_Body = "Email body!!!!"
    Email_Subject = "Email Subject"

    On Error GoTo debugs

    Set Mail_Object = CreateObject("Outlook.Application")
    Set Mail_Single = Mail_Object.CreateItem(0)

    With Mail_Single
        .Subject = Email_Subject
        .To = Email_Send_To
        .cc = Email_Cc
        .BCC = Email_Bcc
        .Body = Email_Body
        .send
    End With

debugs:
    If Err.Description <> "" Then MsgBox Err.Description

End Sub

这篇关于ACCESS 2007 - 在特定事件时使用Outlook自动发送和发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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