7

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

4

2 回答 2

3

我有同样的问题,到目前为止还没有找到答案。作为一个很好的解决方法,我已成功使用此处提供的解决方案:https ://superuser.com/a/228633/74819 。最后,您会在工具栏上看到一个按钮,允许您使用自定义收件人地址和您选择的预定义正文(包括签名)创建新消息。

现在我实际上发现这种方法比我正在寻找的方法更好,因为它更可预测。如果签名(以及消息正文)根据收件人列表发生变化,您将失去对文本的控制。此外,使用您自己的工具,您可以设置的不仅仅是签名。

于 2014-04-30T13:00:21.013 回答
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's 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
于 2014-02-21T06:27:35.560 回答