Outlook add headers and tags for project IDs


Sub AddHeader(m As Outlook.MailItem, strProjectNumber As String)
'Dim m As Outlook.MailItem
    Dim pa As Outlook.PropertyAccessor
    Dim myOlFormat As Integer
    myOlFormat = m.BodyFormat
    m.BodyFormat = olFormatUnspecified
    'Set m = Application.CreateItem(olMailItem)
    'm.Body = m.Subject
    Set pa = m.PropertyAccessor
    pa.SetProperty "http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/X-MS-Exchange-Organization-AECOM-Project", strProjectNumber
    Select Case myOlFormat
        Case olFormatHTML
            m.HTMLBody = m.HTMLBody & vbCr & "[X-MS-Exchange-Organization-AECOM-Project:" & strProjectNumber & "]"
            m.HTMLBody = m.HTMLBody & vbCr & " & strProjectNumber & "]
"
        Case olFormatPlain, olFormatRichText, olFormatUnspecified
            m.Body = m.Body & vbCr & "[X-MS-Exchange-Organization-AECOM-Project:" & strProjectNumber & "]"
    End Select
End Sub

Comments

Popular posts from this blog

Powerpoint countdown and current time in slides VBA

Revit area plans adding new types and references (Gross and rentable)

Revit Python in Visual Studio Revit Stubs 2022 for Python Revit Intellisense