基本上,我们有一个规则设置,当在传入消息的正文中检测到代码字时运行脚本。该脚本将在前面附加一个单词追加当前主题标题。例如,Before:“Test Message”,After:“Dept - Test Message”。有什么想法吗?
答案 0 :(得分:4)
或者如果您需要整个脚本:
使用MailItem作为参数运行脚本。
Sub RewriteSubject(MyMail As MailItem)
Dim mailId As String
Dim outlookNS As Outlook.NameSpace
Dim myMailItem As Outlook.MailItem
mailId = MyMail.EntryID
Set outlookNS = Application.GetNamespace("MAPI")
Set myMailItem = outlookNS.GetItemFromID(mailId)
' Do any detection here
With myMailItem
.Subject = "Dept - " & mailItem.Subject
.Save
End With
Set myMailItem = Nothing
Set outlookNS = Nothing
End Sub
答案 1 :(得分:0)
未经测试:
mailItem.Subject = "Dept - " & mailItem.Subject
mailItem.Save
答案 2 :(得分:0)
Sub AppendSubject(MyMail As MailItem)
Dim strID As String
Dim mailNS As Outlook.NameSpace
Dim mailItem As Outlook.MailItem
strID = MyMail.EntryID
Set mailNS = Application.GetNamespace("MAPI")
Set mailItem = mailNS.GetItemFromID(strID)
mailItem.Subject = "Dept - " & mailItem.Subject
mailItem.Save
Set mailItem = Nothing
Set mailNS = Nothing
End Sub
我们错过了什么吗?编辑:Doh!您已经用完整的脚本回答了我们的问题...谢谢!