Setting selected item in Inbox

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
 
S

Sue Mosher [MVP]

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
 
R

Rick Foster

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top