【发布时间】:2017-01-09 11:13:46
【问题描述】:
我希望自动将电子邮件从 excel vba 发送到 Outlook 2013。
我可以将电子邮件发送给个人并通过 TITUS 分类,但是当我发送到群组电子邮件时仍然收到以下错误。
如何在 VBA 中选择“仍然发送”?
以下是我必须发送电子邮件的代码:
Dim AOMSOutlook As Object
Dim AOMailMsg As Object
Set AOMSOutlook = CreateObject("Outlook.Application")
Dim objUserProperty As Object
Dim OStrTITUS As String
Dim lStrInternal As String
Set AOMailMsg = AOMSOutlook.CreateItem(0)
Set objUserProperty = AOMailMsg.UserProperties.Add("TITUSAutomatedClassification", 1)
objUserProperty.Value = "TLPropertyRoot=ABCDE;Classification=Internal;Registered to:My Companies;"
With AOMailMsg
.To = "mygroup@list.company.com"
.Subject = "my subject"
.Attachments.Add Img
.HTMLBody = "my text"
.Save
.Send
End With
Set AOMailMsg = Nothing
Set objUserProperty = Nothing
Set AOMSOutlook = Nothing
Set lOMailMsg = Nothing
Set objUserProperty = Nothing
Set lOMSOutlook = Nothing
非常感谢任何帮助!
【问题讨论】:
-
这看起来是 Outlook 中的策略设置,而不是编程问题。您可以使用 SendKey..
-
当您将其放在代码顶部时是否会弹出此窗口:
Application.DisplayAlerts = False?您可以在代码底部将其设置回True。 -
@Chrismas007 我去看看 SendKey
-
@MattCremeens 我尝试将 DisplayAlerts 设置为 False 并将 EnableEvents 设置为 false,但警告框仍然出现在 Outlook 中
-
如果你还没有,也可以看看this