|
受够了发信时要F9手工更新签名日期的功能,在网上找了一个帖子,VBA的写法如下,但是一旦保存,那么打开收件箱里的所有邮件正文都变成了签名内容,请各位高手看看原因:
(Microsoft Outlook对象-ThisOutlookSession,代码窗口时是“通用、声明”)
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 = "<font size=2>"
Signature = Signature & "<p> </p>"
Signature = Signature & "<p style=""""font-size: 10px"""">发送者姓名<br />" & mDate & " <br />"
Signature = Signature & "自动签名添加日期成功</p>"
Signature = Signature & "</font> "
End Function
Private Sub Application_Startup()
'GetSignature
Set myOlInspectors = myOlApp.Inspectors
End Sub
Private Sub myOlInspectors_NewInspector(ByVal Inspector As Inspector)
Set myMailItem = Inspector.CurrentItem
With myMailItem
.HTMLBody = Signature()
End With
End Sub
|
|