Changing View to "Search Folder" Upon Start Up

L

Luke242

Hey,
I want outlook to start up my Search Folder named "For Follow Up" showing up
as the default view.

I am truly a beginner and am trying to hack this together. The code below
will switch the view to "standard" folders underneath the Inbox, but not to a
Search Folder. Does any one have any ideas on how to change my view to a
Search Folder named "For Follow Up"?

Thanks for any help, Luke

Dim myolApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace
Set myolApp = CreateObject("Outlook.Application")
Set myNamespace = myolApp.GetNamespace("MAPI")
Set myFolder = _
myNamespace.GetDefaultFolder(olFolderInbox)
Set myolApp.ActiveExplorer.CurrentFolder = _
myFolder.Folders("For Follow Up")
 
E

Eric Legault [MVP - Outlook]

The Search Folders hierarchy is hidden in the default mailbox's Folders
collection so you can't retrieve any by name AFAIK.

You can use the GetEntryIDForCurrentFolder macro below to retrieve the id
for your Search Folder and use that value in this SetSearchFolderAsCurrent
macro:

Sub SetSearchFolderAsCurrent()
Dim objNS As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder

Set objNS = Application.Session
Set objFolder =
objNS.GetFolderFromID("0000000038F2773A1C598D49882D14EC0C5C40C301003782A90F9FC7524AA3B8E8C77AB3BE96000002D28F400000")

Set Application.ActiveExplorer.CurrentFolder = objFolder
Set objNS = Nothing
Set objFolder = Nothing
End Sub

Sub GetEntryIDForCurrentFolder()
Debug.Print Application.ActiveExplorer.CurrentFolder.EntryID
End Sub
 
L

Luke242

Thanks. That works great. It took me a second to figure out how to use
debug.print and modify the code, but I learned something new. As I said, true
beginner... :)

Luke
 
M

Michael Bauer [MVP - Outlook]

Am Mon, 23 Oct 2006 23:03:02 -0700 schrieb Luke242:

Why don´t you simply use the options dialog and chose the folder you want to
start with?
 
L

Luke242

Hhhmmm.... That takes all the fun out of it.

Seriously though, I searched the Outlook help file and Google for that
option and could not find it. After your suggestion, I was able to find it
and got my program all dialed in. Oh well...

Luke
 

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