Well thanks to a bit of help elsewhere I am happily using the following code
Dim pos() As Integer , cnt() As Integer
listofnames = Array("Fred", "Jim", "Syd")
Redim pos(UBound(listofnames))
Redim cnt(UBound(listofnames))
Set folderitems = ActiveExplorer.CurrentFolder.Items
For Each mitem In folderitems
strt = Len(mitem.body)
For i = 0 To UBound(pos)
pos(i) = InStrRev(mitem.Body, listofnames(i), strt)
If pos(i) > 0 Then strt = pos(i): firstfnd = listofnames(i)
Next
For i = 0 To UBound(listofnames)
If listofnames(i) = firstfnd Then cnt(i) = cnt(i) + 1: exit For
Next
Next
For i = 0 To UBound(listofnames)
msg = msg & listofnames(i) & " count of emails = " & cnt(i) & vbnewline
Next
MsgBox msg
However, I now need a slightly different variation to find the last occurence of a name in a bunch of emails
PHP code would be "strripos" instead of "InStrRev" but is there a way to do it on outlook?
I'll bet its pretty simple and im just being stupid
Bookmarks