H
Heinlein
I've tried an Outlook group, but have received no replies.
I don't know Visual Basic, outside of a few examples I found through
Google.
I'm trying to write a rule to compensate for laziness caused by
program changes. Used to be, case numbers for family law cases where I
work were written as follows: 12-DR-012345. Now, you can get away
with 12DR12345, and the file management program accepts it.
I had a filter in MS Outlook so that all messages with -DR- in it got
moved to a subfolder in my email, with the name Family Law. Now that
people can be lazy, that rule can't work.
I tried following guidelines at this location:
http://www.stackoverflow.com/questions/3865500/regular-expression-rul...
mainly those in the "first page" area. For a while my rule would pop
up when a message came in with the new format, so I assume the rule
"saw it". Unfortunately, I can't move the message to my Family Law
subfolder.
This is what my routine looks like:
Sub CaseNumberFilter(Message As Outlook.MailItem)
Dim MatchesSubject, MatchesBody
Dim RegEx As New RegExp
'e.g. 1000-10'
RegEx.Pattern = "([0-9]{2}DR[0-9]{6})"
'Check for pattern in subject and body'
If (RegEx.Test(Message.Subject) Or RegEx.Test(Message.Body)) Then
Set MatchesSubject = RegEx.Execute(Message.Subject)
Set MatchesBody = RegEx.Execute(Message.Body)
If Not (MatchesSubject Is Nothing And MatchesBody Is Nothing)
Then
'Assign "Job Number" category'
Message.Categories = "Job Number"
Message.Save
End If
End If
End Sub
No idea what to do to make it work. Appreciate any help. Now that
programming lets people "be lazy", I'll need three versions of this
macro/routine. The number I'm filtering for could resemble anything
from:
1DR1 to 12DR012345.
Thanks in advance.
Oh, my shop used MS Office 2007.
I don't know Visual Basic, outside of a few examples I found through
Google.
I'm trying to write a rule to compensate for laziness caused by
program changes. Used to be, case numbers for family law cases where I
work were written as follows: 12-DR-012345. Now, you can get away
with 12DR12345, and the file management program accepts it.
I had a filter in MS Outlook so that all messages with -DR- in it got
moved to a subfolder in my email, with the name Family Law. Now that
people can be lazy, that rule can't work.
I tried following guidelines at this location:
http://www.stackoverflow.com/questions/3865500/regular-expression-rul...
mainly those in the "first page" area. For a while my rule would pop
up when a message came in with the new format, so I assume the rule
"saw it". Unfortunately, I can't move the message to my Family Law
subfolder.
This is what my routine looks like:
Sub CaseNumberFilter(Message As Outlook.MailItem)
Dim MatchesSubject, MatchesBody
Dim RegEx As New RegExp
'e.g. 1000-10'
RegEx.Pattern = "([0-9]{2}DR[0-9]{6})"
'Check for pattern in subject and body'
If (RegEx.Test(Message.Subject) Or RegEx.Test(Message.Body)) Then
Set MatchesSubject = RegEx.Execute(Message.Subject)
Set MatchesBody = RegEx.Execute(Message.Body)
If Not (MatchesSubject Is Nothing And MatchesBody Is Nothing)
Then
'Assign "Job Number" category'
Message.Categories = "Job Number"
Message.Save
End If
End If
End Sub
No idea what to do to make it work. Appreciate any help. Now that
programming lets people "be lazy", I'll need three versions of this
macro/routine. The number I'm filtering for could resemble anything
from:
1DR1 to 12DR012345.
Thanks in advance.
Oh, my shop used MS Office 2007.