Setting selected item in Inbox

  • Thread starter Thread starter Rick Foster
  • Start date Start date
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
 
Outlook provides no methods for setting the selected item.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
Thank you.


Outlook provides no methods for setting the selected item.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
Back
Top