1. OK
2. AND? I assume you mean ALL?
3. VBA text strings are case sensitive. I have assumed that case is not important.
4. OK Save the strings one to a line with their associated paths in a text file in the following format and change the code to reflect the full path and filename of the text file:
David+Green+house|s:\2465\cons\
i.e. use + between the search strings and separate the path from the search with a pipe character '|'. Note folder separators are \ not /
6. I don't know what that means. The code will show a message box with the folder name
7. and will open the folder in Windows FileExplorer.
You can use the test macro to test on files in the inbox, and/or use the main macro as a script associated with a rule that identifies the messages to be searched.
Code:
Option Explicit
Sub TestSelectedMessage()
Dim olMsg As MailItem
On Error Resume Next
Set olMsg = ActiveExplorer.Selection.Item(1)
CheckMail olMsg
lbl_Exit:
Exit Sub
End Sub
Sub CheckMail(olItem As Outlook.MailItem)
Dim sSubject As String
Dim sTextRow As String
Dim sSearch As String
Dim vSearch As Variant
Dim sPath As String
Dim sFileName As String: sFileName = "C:\Path\CheckList.txt" 'change as appropriate
Dim iFileNo As Integer: iFileNo = FreeFile
Dim i As Integer
Dim j As Long
Open sFileName For Input As #iFileNo
sSubject = LCase(olItem.subject)
Do While Not EOF(iFileNo)
Line Input #iFileNo, sTextRow
i = 0
sPath = Split(sTextRow, "|")(1)
sSearch = Split(sTextRow, "|")(0)
vSearch = Split(sSearch, "+")
For j = LBound(vSearch) To UBound(vSearch)
If InStr(1, sSubject, LCase(vSearch(j))) > 0 Then
i = i + 1
End If
Next j
If i = UBound(vSearch) + 1 Then
MsgBox sPath
GetFolder sPath
Exit Do
End If
Loop
Close #iFileNo
End Sub
Sub GetFolder(strFolder As String)
Shell "C:\Windows\SysWOW64\explorer.exe /root," & strFolder, vbNormalFocus
lbl_Exit:
Exit Sub
End Sub