2010 prospect of recipient based change

I was wondering if it is possible when you enter the recipient address for Outlook 2010 to automatically determine this address and change the signature accordingly? Just a general question.

+4
source share
2 answers

I had the same question and so far I have not found the answer. As a good workaround, I have successfully used the solution proposed here: https://superuser.com/a/228633/74819 . At the end, you get a button on the toolbar that allows you to create a new message with a custom "To" address and the specified body text (including signature) of your choice.

, , , . (, , ) , . , , .

+2

? , . .

Public WithEvents goInspectors As Outlook.Inspectors
Public WithEvents myMailItem As Outlook.MailItem

Private Sub Application_Startup()
    Initialize_Inspector
End Sub

Private Sub Initialize_Inspector()
    Set goInspectors = Outlook.Application.Inspectors
End Sub

Private Sub goInspectors_NewInspector(ByVal Inspector As Inspector)
    If Inspector.currentItem.Class = olMail Then
        Set myMailItem = Inspector.currentItem
    End If
End Sub

Private Sub myMailItem_PropertyChange(ByVal Name As String)

    'The variable below should be modified for your situation.
    'If you are in an Exchange environment, then you can use "last name, firstname"(caps-sensitive).
    'If the the recipient is not in Outlook address list, use "person@email.com"
    customSignatureFor = "Lastname, Firstname"

    'Use vbCrLf to account for enter/returns
    oldSignature = "Respectfully," & vbCrLf & vbCrLf & "Phillip"
    newSignature = "v/r," & vbcrlf & "Phil"

    If Name = "To" Then
        For i = 1 To myMailItem.Recipients.count
            If InStr(myMailItem.Recipients(i), customSignatureFor) > 0 Then
                tempstring = Replace(myMailItem.Body, oldSignature, newSignature)
                myMailItem.Body = tempstring
            End If
        Next
    End If
    End Sub
+1

Source: https://habr.com/ru/post/1527849/


All Articles