我想编写一个脚本,将接收特定的传入电子邮件,更改其主题行,然后将该电子邮件移至特定的文件夹。
我可以找到在邮件本身打开时会更改主题行的脚本,但是当与“移至文件夹”规则绑定时,主题不会更改。
我已经尝试过此代码,该代码可以在我打开的邮件的主题行中添加文本。
Sub myRuleMacro(Item As Outlook.MailItem)
Sub AddToEndOfSubjectLine()
If ActiveInspector Is Nothing Then Exit Sub
ActiveInspector.CurrentItem.Save
ActiveInspector.CurrentItem.subject = ActiveInspector.CurrentItem.subject & " HELLO!"
End Sub
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
End Sub
这里是一个例子,尝试一下
Public Sub Example(Item As Outlook.MailItem)
Dim SubFolder As Outlook.folder
Set SubFolder = Application.GetNamespace("MAPI").GetDefaultFolder _
(olFolderInbox).Folders("folder name here") '<- change folder name
Debug.Print Item.Subject ' Print on Immediate Window
Item.Subject = Item.Subject & " HELLO!"
Item.Save
Item.Move SubFolder
End Sub