ItemAdd Event does not fire consistently

  • Thread starter Thread starter Istabrak
  • Start date Start date
I

Istabrak

Greetings,

I am using VBA to code my ItemAdd event handler to capture any new
items in the "Sent Items" folder.

I am using Outlook2k and WinXP Pro.
Sometimes it fires correctly while at othertimes the handler does not
get called at all.
I noticed that if I restart/shutdown the pc it works for a while.
Here is a sample of my code.
Is this a known problem?

Thanks in advance,

Ista

-----------------
' All the code is in the "ThisOutlookSession"

Private WithEvents sentMailItems As Outlook.Items
Private sentItemRecipientColl As New Collection

Private Sub sentMailItems_ItemAdd(ByVal Item As Object)

MsgBox "A new mail has been added to the Sent Mail folder", ,
Item.Subject

'Debug.Print "Item.To: " & Item.To
For intj = 1 To sentItemRecipientColl.Count
If StrComp(Item.To, sentItemRecipientColl(intj), 1) = 0
Then
'Debug.Print "Handler: Item Exists"
Item.Delete
Exit For
End If
Next

End Sub
 
Back
Top