该方法与我无关。无论是宏,还是以电子邮件发送的方式自动触发 我想知道Outlook是否有办法根据收件人自动分配签名。
感谢。
答案 0 :(得分:0)
基于此处的代码http://www.rondebruin.nl/win/s1/outlook/signature.htm
您可以将其设置为从Application_ItemSend调用,但这可能会造成麻烦。
Sub With_Variable_Signature()
Dim itm As mailItem
Dim StrSignature As String
Dim sPath As String
Dim recip As Recipient
Set itm = ActiveInspector.currentItem
sPath = Environ("appdata") & "\Microsoft\Signatures\defaultSig.htm"
For Each recip In itm.Recipients
Debug.Print recip.name
If recip.name = "somebody" And recip.type = olTo Then ' or = olcc or = olbcc
sPath = Environ("appdata") & "\Microsoft\Signatures\customizedSig.htm"
Exit For
End If
Next
If Dir(sPath) <> "" Then
StrSignature = GetBoiler(sPath)
Else
StrSignature = ""
End If
With itm
.HTMLBody = .HTMLBody & vbNewLine & vbNewLine & StrSignature
End With
Set itm = Nothing
End Sub
Function GetBoiler(ByVal sFile As String) As String
'Dick Kusleika
Dim fso As Object
Dim ts As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
GetBoiler = ts.readall
ts.Close
End Function