View Single Post
  #2  
Old October 2nd 09, 05:30 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default NewMailEx Only provides First e-mail in inbox

Don't use a MsgBox to test any kind of automatic processing, because it's
modal and will stop execution while the box is displayed. Use Debug.Print
instead.

If you're working with an Exchange account in cached mode, NewMailEx will
fire for every single item received, so you'll see only one entry ID each
time. In online mode, it will return multiple items, but may skip a small
number under extremely heavy loads.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"ben" (remove this if mailing direct) wrote in
message ...
When using NewMailEx to get a list of received e-mails, EntryIDCollection
will only return the very first e-mail received, even if 10-15 e-mails
come
in at the same time.

This is my code in it's entirety.


Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim arr() As String
Dim i As Integer
Dim m As MailItem
On Error Resume Next
arr = Split(EntryIDCollection, ",")
For i = 0 To UBound(arr)
Set m = Application.Session.GetItemFromID(arr(i))
MsgBox m.Subject
Next
End Sub


Or am I going at this backwards, does (Will return a list of all e-mails
that have arrived since this event last fired) mean that if I receive 5
e-mails, the first one will trigger.. but the next time I receive an
e-mail
the previous 4 , plus the one just in will trigger? And if so, won't that
leave a few e-mails always in limbo?



Ads