View Single Post
  #2  
Old May 29th 08, 01:22 AM posted to microsoft.public.outlook
[email protected]
external usenet poster
 
Posts: 20
Default Open non-Inbox folder if any unread there

Thank you Peter for the reply and helpful suggestions. But I only want
to go to Unread of one specific folder; and as far as using a search
folder goes I don't see where you can specify "Unread," which is the
only circumstance I want to go there. Anyway I hadn't even conceived
of using a search folder as startup default. Thank you for that
thought-inspiring idea.

Well if it's not built in this should be easy for regular Outlook
coders. Is there another Outlook group where programmers go?
Otherwise, this (below) needs help. Note the crashing line containing
the word invalid. (Better yet, is there a direct property instead of
For Each, in the spirit of "Unread.count" ?)

Private Sub test_StartupSearchFolderFooForUnRead() 'and go there if
anything unread
Dim olapp As Outlook.Application, objFolder As Outlook.Folder,
myItem As mailItem
Set olapp = Outlook.Application 'Should I even bother w/ this var.?
Set objFolder = olapp.Session.Folders("Mailbox - John
Doe").Folders("Excel")
For Each myItem In objFolder 'This line invalid. Help?
If myItem.UnRead Then
objFolder.Display
Exit For
End If
Next
Set objFolder = Nothing: Set olapp = Nothing
End Sub

I guess "run a script" means something else.

Might this go in ThisOutlookSession Application_Startup?

I understand that this does not switch from the current Folder (which
I have defaulted to Inbox).

Thanks for reading this far!
Ads