Search code examples
emailvbacdo.message

How can I set "High Importance" on email sent using VBA?


I tried setting a few properties on this object to send an email with high importance, but nothing seemed to work. Here is what I tried:

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

Solution

  • It's been a while since I worked with Outlook and VBA but I still have various cheat sheets and links. I dug this up; hope it helps!

    Try setting the .Importance property in your mail object

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