OK, I'm a VBA dunce. Not familiar with method concept. Here is the code, if
you could tell me what to do, i'd appreciate it.
Public Sub Check_Validation()
Dim oApp As Application 'set up the variables
Dim oNS As NameSpace
Dim oMessage As Object
Dim oAttachments As Outlook.Attachments
Dim oSave_outbox As Outlook.MAPIFolder
Dim my_savebox As Outlook.MAPIFolder
Dim NbrMsgs, f, fs
Dim val_string
Const OLTXT = 0
' Create new Outlook Application
Set oApp = New Outlook.Application
Set oNS = oApp.GetNamespace("MAPI")
Set oFolder = oNS.GetDefaultFolder(olFolderInbox)
Set fs = CreateObject("Scripting.FileSystemObject")
cc_dir = "\\<directory-path>"
Other_dir = "\<directory-path>\"
REL_DIR = "\\<directory-path>\"
'will need some code to ensure file and directory Structure are not too long
val_string = "VALID"
compare_string = " "
NbrMsgs = 0
'Cycle through the messages
For Each oMessage In oFolder.Items
With oMessage
Set myItem = oMessage
strname = myItem.Subject
'Need to check both upper and lower case, so transform subject to
upper case for comparison
compare_string = UCase(oMessage.Subject)
str_len = Len(compare_string)
'Process message if the subject includes the word validation
If InStrRev(compare_string, val_string) > 0 Then
If InStrRev(compare_string, "CC") > 0 Then
FileName = cc_dir & strname
ElseIf InStrRev(compare_string, "REL") > 0 Then
FileName = REL_DIR & strname
Else: FileName = Other_dir & strname
End If
dir_len = Len(FileName) - str_len
Set file = fs.CreateTextFile(FileName, True)
NbrMsgs = NbrMsgs + 1
file.WriteLine ("Validation File sent using Subjectline: " &
strname)
file.Close
End If
.Delete
End With
Next
End Sub