K
kf9150
Hello,
I thought the following should display the last received email in the
inbox. But apparently it is not reliable, at least from my experiment.
Any idea why?
I was thinking of sorting all the mails in inbox by the ReceivedTime
property, but that would not be fast if there are plenty emails. Any
other faster ways?
Public Sub DisplayLastReceivedMail()
Dim myNamespace As NameSpace
Dim myFolder As Folder
Dim myItem As MailItem
Set myNamespace = Application.GetNamespace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox)
Set myItem = myFolder.Items(myFolder.Items.Count)
myItem.Display
End Sub
Thank you! (Btw, I'm using Outook 2007.)
Kelie
I thought the following should display the last received email in the
inbox. But apparently it is not reliable, at least from my experiment.
Any idea why?
I was thinking of sorting all the mails in inbox by the ReceivedTime
property, but that would not be fast if there are plenty emails. Any
other faster ways?
Public Sub DisplayLastReceivedMail()
Dim myNamespace As NameSpace
Dim myFolder As Folder
Dim myItem As MailItem
Set myNamespace = Application.GetNamespace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox)
Set myItem = myFolder.Items(myFolder.Items.Count)
myItem.Display
End Sub
Thank you! (Btw, I'm using Outook 2007.)
Kelie