I have written an Outlook macro to help our project/email filing admin. It scans her inbox for all message subjects containing the text "BCE #" followed by a 4 or 5 digit number ie "New Project BCE #4311" and then saves them on the network under that job number. However, some people are sending messages the pertain to multiple job numbers so their subject would be "New set of jobs BCE #11034 BCE #7677".
Is there a way that I can have the macro save the message under each job number in the subject? Here's snippets of my current code.
Again, this is just a portion of my code and most importantly of all - I am not a programmer nor have I had any training whatsoever. If this is overly tedious or there is a much easier way, let me know.
Another thing - I can not just pull out any numbers from the subject because we also have some that reference facility numbers or zip codes like "Another project fac #4551 bce #8001".
Thanks.
Is there a way that I can have the macro save the message under each job number in the subject? Here's snippets of my current code.
Code:
Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
For Each item In Inbox.Items
If InStr(1, item.Subject, "BCE #", 1) > 0 Then
intPos = InStrRev(item.Subject, "BCE #", , vbTextCompare) + 5
strtemp = Mid$(item.Subject, intPos, 5)
If IsNumeric(strtemp) = True Then
strlength = Len(strtemp)
End If
If strlength = 5 Then
job2 = Left(strtemp, 2)
sjob = "p:\" & Format(job2, "00") & "000s\" & strtemp
semail = sjob & "\email"
End If
If strlength = 4 Then
job1 = Left(strtemp, 1)
sjob = "p:\" & Format(job1, "00") & "000s\" & strtemp
semail = sjob & "\email"
End If
If DirExists(sjob) Then
If DirExists(semail) Then
If FileThere(sjob & "\email\" & item.Subject & ".msg") Then
n = 0
Do
If FileThere(sjob & "\email\" & item.Subject & "-" & n & ".msg") Then
n = n + 1
Else
Exit Do
End If
Again, this is just a portion of my code and most importantly of all - I am not a programmer nor have I had any training whatsoever. If this is overly tedious or there is a much easier way, let me know.
Another thing - I can not just pull out any numbers from the subject because we also have some that reference facility numbers or zip codes like "Another project fac #4551 bce #8001".
Thanks.