【问题标题】:How can I set "High Importance" on email sent using VBA?如何在使用 VBA 发送的电子邮件上设置“高重要性”?
【发布时间】:2011-03-19 03:19:51
【问题描述】:

我尝试在此对象上设置一些属性以发送具有高度重要性的电子邮件,但似乎没有任何效果。这是我尝试过的:

objEmail.Importance = 2

objEmail.Configuration.Fields.Item("urn:schemas:mailheader:X-MSMail-Priority") = "High"      ' For Outlook 2003

objEmail.Configuration.Fields.Item("urn:schemas:mailheader:X-Priority") = 2                  ' For Outlook 2003 also

objEmail.Configuration.Fields.Item("urn:schemas:httpmail:importance") = 2

Function Send(sTo As String, sFrom As String, sSubject As String)
    Set objEmail = CreateObject("CDO.Message")
        objEmail.From = sFrom
        objEmail.To = sTo
        objEmail.Subject = sSubject
        objEmail.Textbody = emailBody
        objEmail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "my.smtp.server"
        objEmail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        // is there a property for high importance, outlook 2007?
        objEmail.Configuration.Fields.Update        
    objEmail.Send
End Function

【问题讨论】:

标签: email vba cdo.message


【解决方案1】:

我使用 Outlook 和 VBA 已经有一段时间了,但我仍然有各种备忘单和链接。我把这个挖出来了;希望有帮助!

尝试在邮件对象中设置 .Importance 属性

with myEmail
    'can be olImportanceNormal, olImportanceHigh or olImportanceLow
    .Importance = olImportanceNormal
    .Subject = "Subject line"
    .Body = "Body Content"
end with

【讨论】:

  • 噢!不知何故,我完全错过了您正在使用 .importance 的 OP。
  • 在任何情况下,olImportanceNormal 是一个内置常量,不应该用引号引起来。
【解决方案2】:

.Importance = 2(适用于 2015 年的任何人)。

【讨论】:

  • 从 2013 年升级到 2015 年.. 这是修复
【解决方案3】:

来自 cmets 中的 Remou's link,这适用于 Outlook 2010 通过 VBA:

cdoMessage.Fields.Item(cdoImportance) = cdoHigh  

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-14
    • 2017-10-28
    相关资源
    最近更新 更多