[英]Outlook 2010 change signature based on recipient
我想知道當您輸入Outlook 2010的收件人地址以自動檢測此地址並相應更改簽名時是否可能? 只是一個普遍的問題。
我有同樣的問題,到目前為止還沒有找到答案。 作為一個很好的解決方法,我已成功使用此處提供的解決方案: https : //superuser.com/a/228633/74819 。 最后,您可以在工具欄上找到一個按鈕,允許您使用自定義To地址和您選擇的預定義正文(包括簽名)創建新消息。
現在我發現這個方法比我想要的更好,因為它更容易預測。 如果簽名(以及郵件正文)根據收件人列表進行更改,您將失去對文本的控制權。 此外,使用您自己的工具,您可以設置不僅僅是簽名。
您是在尋找設置來執行此操作還是您願意使用宏? 如果您願意使用宏,請參閱下文並回答問題。
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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.