该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
老问题,但没有合适的解决方案啊
比如我设置了一个vba签名,怎么确保这个签名只在新建邮件、回复/转发邮件时出现?
像那个日期自动更新的签名,我根据网上的代码改了下,新建邮件没问题了,但回复和转发还不行的样子,该怎么改?
myMailItem.To = "" 收件人为空时插入签名,转发邮件时应该满组要求吧,但插不进去的样子,如果不加这个限制,又会连接收到的邮件都强行插入签名……
Dim myOlApp As New Outlook.Application
Private WithEvents myOlInspectors As Outlook.Inspectors
Private myMailItem As Outlook.MailItem
Function Signature() As String
Dim mDate As Date
mDate = Format(Now, "yyyy-MM-dd")
Signature = ""
Signature = Signature & mDate
Signature = Signature & " "
End Function
Private Sub Application_Startup()
Set myOlInspectors = myOlApp.Inspectors
End Sub
Private Sub myOlInspectors_NewInspector(ByVal Inspector As Inspector)
Dim str As String
str = TypeName(Inspector.CurrentItem)
If str = "MailItem" Then
Set myMailItem = Inspector.CurrentItem
If myMailItem.To = "" Then
With myMailItem
.HTMLBody = Signature() & .HTMLBody
End With
End If
End If
End Sub