Best way to dynamically build Categories from subject string?

  • Thread starter Thread starter Hug Dall
  • Start date Start date
H

Hug Dall

This is in Outlook 2000.
I have a need to dynamically build the Category of a incoming email,
based on a pattern within the subject field. I have tried a formula
field in a user-defined field and now are looking at VBA in a macro.
What I need to do is scan for a string of 10 digits in the subject and
use that specifically as the Category, or at least a new field. Any
ideas how to do this using expressions or something?
eg.
This is a subject = null
this is 1234567890 another = 1234567890 as category
yet another 4321 subj = null

Hard, huh?
 
This might help. It's a little function that takes a
string and returns a 10-digit number if such exists as
any "word" in the string:

Function GetSubjectNumber(strSubject As String)
Dim arr
Dim strText As String
arr = Split(strSubject, " ")
For i = 0 To UBound(arr)
strText = arr(i)
If IsNumeric(strText) And Len(strText) = 10 Then
GetSubjectNumber = strText
Exit For
End If
Next
End Function
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at
http://www.slipstick.com
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top