R
Rick Foster
I'd like to create a macro to find the next unread item in the Inbox and
select that item.
Here is code that searches for the unread items and opens them, but I do not
want to open every email - I'd rather make the choice.
Public Sub FindNextUnread()
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myfolder = myNameSpace.GetDefaultFolder(olFolderInbox)
For i = 1 To myfolder.Items.Count
Set myitem = myfolder.Items(i)
If myitem.UnRead Then
myitem.Display
End If
Next
End Sub
Thanks,
Rick
select that item.
Here is code that searches for the unread items and opens them, but I do not
want to open every email - I'd rather make the choice.
Public Sub FindNextUnread()
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myfolder = myNameSpace.GetDefaultFolder(olFolderInbox)
For i = 1 To myfolder.Items.Count
Set myitem = myfolder.Items(i)
If myitem.UnRead Then
myitem.Display
End If
Next
End Sub
Thanks,
Rick