AnthonyC
10-04-2016, 10:33 AM
I have the following VBA script that I have setup along w/ a rule in Outlook 2016. The rule + script works correctly if I go to Rule Wizard and run manually but doesn't trigger when new mail comes in and rules should be running the script. I found various references to similar issue that mentioned I need to change the Trust Center setting so I have changed Macro setting to Enabled all.
p.s. I think this issue is not related to the code as all but related to how Outlook rule trigger VBA script
Sub filter(Item As Outlook.MailItem)
Set Reg1 = CreateObject("VBScript.RegExp")
Reg1.IgnoreCase = True
Reg1.Global = True
Reg1.Pattern = "foo"
If Reg1.Test(Item.Subject) Then
strSubject = Item.Subject
Item.Subject = strSubject & "bar"
Item.Save
End If
End Sub
p.s. I think this issue is not related to the code as all but related to how Outlook rule trigger VBA script
Sub filter(Item As Outlook.MailItem)
Set Reg1 = CreateObject("VBScript.RegExp")
Reg1.IgnoreCase = True
Reg1.Global = True
Reg1.Pattern = "foo"
If Reg1.Test(Item.Subject) Then
strSubject = Item.Subject
Item.Subject = strSubject & "bar"
Item.Save
End If
End Sub