Outlook规则-通过规则中的脚本更改电子邮件主题无效。

问题描述 投票:1回答:1

我已经在Outlook中创建了一条规则,该规则会自动将传入的消息移动到文件夹并运行脚本来修改主题。

这是规则:

enter image description here

这是我的脚本:

Public Sub RemoveIrDateTime(Item As Outlook.MailItem)
'Item As Outlook.MailItem

    'stringToMatch = "issued at 11/14/17 6:28 PM"

    Set issuedMsg = New RegExp
    Set priSev = New RegExp
    Set iR = New RegExp

    With issuedMsg
        .Pattern = "issued at \d{1,2}/\d{1,2}/\d\d .+"
        .Global = True
        End With

    With priSev
        '.Pattern = "^P\d/S\d - IR"
        .Pattern = "^.+IR"
        .Global = True
        End With

    Item.Subject = issuedMsg.Replace(Item.Subject, "")
    Item.Subject = priSev.Replace(Item.Subject, "IR")
    'Item.Subject = Left(EmItemail.Subject, 60)

    Item.Save

End Sub

当匹配的消息到达时,它被移动到指定的文件夹,但是主题没有被更新。

但是,如果我使用“管理规则和警报”选项,并针对目标文件夹“事件”运行规则,则该文件夹中电子邮件的主题将按我的期望进行更新。

Outlook中是否存在错误,因此移动邮件会阻止脚本运行?关于如何解决的任何想法?

outlook-vba
1个回答
0
投票

这是规则的顺序吗?首先,您将其移动,如果它已从收件箱中移走,“然后”规则会对其产生影响吗?还是仍在收件箱中查找?

最好的问候,艾伦

© www.soinside.com 2019 - 2024. All rights reserved.