Open non-Inbox folder if any unread there

Z

zofficedepot

I want upon starting OL07 to have it normally go to Inbox, but instead
go to folder XYZ if there is anything unread in XYZ. (BTW, I don't
care if it does or doesn't when a new item arrives in XYZ after OL is
running.)

Can this be done within a Rule? This always applies to a certain
Sender. Is there an action that changes the current folder when it
fires the rule? How about an action that just opens the message (I'm
surprised that I don't see that action listed)?

I also noticed one of the actions for a rule is "run a script." Does
that refer to a VBA sub name? If so, I could change folders that way.
( However, just as a matter of style, I'd prefer to avoid code if
it's built it - avid coder avoids coding :) )
 
P

Peter Durkee

You can't write a rule to make Outlook behave as you want, but you could
have Outlook go to the Unread Mail Search Folder when it starts up. Since
you can restrict the folders that search folders search in you can get
approximately the result you want this way.

-Peter
 
Z

zofficedepot

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!
 
Z

zofficedepot

Am I using the wrong forum? Or is this subject name such that few even
read the thread? I thought this would be trivial to most nonbeginners.
 
B

Brian Tillman

Well if it's not built in this should be easy for regular Outlook
coders. Is there another Outlook group where programmers go?

Yes. Code discussion is in microsoft.public.outlook.program_vba
 

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