简体   繁体   English

使用 Outlook 2013/Excel 2013 发送邮件

[英]Sending Emails with Outlook 2013/Excel 2013

I currently have a program that queues up emails to send in a spreadsheet and then sends them out through the Outlook application (Excel and Outlook are both 2013 versions).我目前有一个程序可以将电子邮件排队发送到电子表格中,然后通过 Outlook 应用程序将它们发送出去(Excel 和 Outlook 都是 2013 版本)。

When I run the program, it goes through without a problem, however when a coworker runs the program they continue to get the prompts that "A program is trying to send a message on your behalf" and then they have to allow or deny each one individually.当我运行该程序时,它没有问题,但是当同事运行该程序时,他们继续收到“程序正在尝试代表您发送消息”的提示,然后他们必须允许或拒绝每一个个别地。

I have looked through different methods for addressing this from changing the registry (tried that and it did not change anything) to security settings (still nothing).我已经通过不同的方法来解决这个问题,从更改注册表(尝试过但没有改变任何东西)到安全设置(仍然没有)。

Is there a way to address this with VBA?有没有办法用 VBA 解决这个问题?

The current code is:当前代码是:

Sub SendEmail(what_address As String, subject_line As String, mail_body_message As String)

Dim olApp As Outlook.Application
Dim oAttach As Outlook.Attachment

Set olApp = CreateObject("Outlook.Application")

Dim olMail As Outlook.MailItem

Set olMail = olApp.CreateItem(olMailItem)

With olMail

.To = "ADDRESS"

.Subject = "SUBJECT"

.BodyFormat = olFormatHTML

.HTMLBody = mail_body_message

'.CC = "EMAIL"
.BCC = ""

.Importance = olImportanceHigh

.ReadReceiptRequested = True

.Send

End With

End Sub 

Thanks!谢谢!

Short answer: install an up-to-date anti-virus app or use products like Redemption or ClickYes . 简短的答案:安装最新的防病毒应用程序或使用RedemptionClickYes之类的产品

See http://www.outlookcode.com/article.aspx?id=52 for more options and detailed discussion. 有关更多选项和详细讨论,请参见http://www.outlookcode.com/article.aspx?id=52

From Ron's site instead of .Send 从Ron的网站而不是.Send

 .Display 
 Application.Wait (Now + TimeValue("0:00:02"))
 Application.SendKeys "%s"

This will just bring up the email and sendkeys Alt-S to send. 这将只显示电子邮件和发送键Alt-S发送。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM