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("0000000038F2773A1C598D49882 D14EC0C5C40C301003782A90F9FC7524AA3B8E8C77AB3BE960 00002D28F400000")
Set Application.ActiveExplorer.CurrentFolder = objFolder
Set objNS = Nothing
Set objFolder = Nothing
End Sub
Sub GetEntryIDForCurrentFolder()
Debug.Print Application.ActiveExplorer.CurrentFolder.EntryID
End Sub
--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog:
http://blogs.officezealot.com/legault/
"Luke242" wrote:
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")