Change Outlook signature via VBA [closed]

4

How to change Outlook signature via VBA depending on a particular situation ...

In my Outlook I have 2 pre-defined signatures (Internal and External)

I already have a Script that identifies when the email is External or Internal

Basic script example used

Sub InternalMail(olMail As MailItem)
    Dim rec As Recipient
    Dim myDomain1 As String
    Dim tpMail As String

    myDomain1 = "@domain.com.br"

    If (InStr(1, olMail.SenderEmailAddress, myDomain1) > 0) Then
        For Each rec In olMail.Recipients
          cMail = LCase(rec.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x39FE001E"))
            If (InStr(1, cMail, myDomain1) > 0) Then
              tpMail = "Interno"
            Else
              tpMail = "Externo"
              Exit For
            End If
        Next
    Else
        tpMail = "Externo"
    End If

    MsgBox tpMail
End Sub


Sub Test()
Dim olMsg As MailItem
    On Error Resume Next
    Set olMsg = ActiveExplorer.Selection.Item(1)
    InternalMail olMsg
End Sub

I just need to figure out how to change the signature.

    
asked by anonymous 04.05.2016 / 19:12

0 answers