bont
I lifted this code off the net some time ago. Can't remember the site so I don't know who you should really thank.
It has a section that you could use to detect emails from certain people, and move those emails to specific folders. I don't see why you couldn't create a text file for the log (using the FileSystem.Freefile method), open if for append, and put some text in.
Hope it helps.
Steve
Public Sub ProcessEmail()
Dim myol As Outlook.Application
Dim myNS As NameSpace
Dim myInbox As MAPIFolder
Dim f1 As MAPIFolder
Dim f2 As MAPIFolder
Dim dest As MAPIFolder
Dim msg As Object
Dim ToBeDeleted() As MailItem
Dim ToBeMoved() As MailItem
Dim NumberToDelete As Integer
Dim NumberToMove As Integer
Dim idx As Integer
' Initialize variables.
NumberToDelete = 0
NumberToMove = 0
' Get a reference to the Inbox.
Set myNS = GetNamespace("MAPI")
Set myInbox = myNS.GetDefaultFolder(olFolderInbox)
' Get a reference to the destination folder.
Set dest = Nothing
For Each f1 In myNS.Folders
For Each f2 In f1.Folders
If f2.Name = "Immediate Attention" Then
Set dest = f2
End If
Next
Next
' If the destination folder wasn' t found, display
' a message and then clean up and exit.
If dest Is Nothing Then
MsgBox "The destination folder does not exist."
Set f1 = Nothing
Set f2 = Nothing
Set myNS = Nothing
Set myInbox = Nothing
Exit Sub
End If
' Loop through all messages in the Inbox.
For Each msg In myInbox.Items
' Process only mail messages.
If TypeOf msg Is MailItem Then
' If the subject contains "free", mark the
' message for deletion.
If InStr(1, msg.Subject, "free", _
vbTextCompare) > 0 Then
NumberToDelete = NumberToDelete + 1
ReDim Preserve ToBeDeleted(NumberToDelete)
Set ToBeDeleted(NumberToDelete) = msg
' If the message is from "Linda Cooper",
' mark it to be moved.
ElseIf msg.SenderName = "Linda Cooper" Then
NumberToMove = NumberToMove + 1
ReDim Preserve ToBeMoved(NumberToMove)
Set ToBeMoved(NumberToMove) = msg
End If
End If
Next
' Delete messages marked for deletion (if any).
If NumberToDelete > 0 Then
For idx = 1 To NumberToDelete
ToBeDeleted(idx).Delete
Next
End If
' Move messages marked to be moved (if any).
If NumberToMove > 0 Then
For idx = 1 To NumberToMove
ToBeMoved(idx).Move dest
Next
End If
' Clean up.
Set myNS = Nothing
Set myInbox = Nothing
Set f1 = Nothing
Set f2 = Nothing
Set dest = Nothing
Set msg = Nothing
End Sub