Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Changing View to "Search Folder" Upon Start Up (http://www.outlookbanter.com/outlook-vba/30852-changing-view-search-folder-upon.html)

Luke242 October 24th 06 07:03 AM

Changing View to "Search Folder" Upon Start Up
 
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")

Eric Legault [MVP - Outlook] October 24th 06 06:46 PM

Changing View to "Search Folder" Upon Start Up
 
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")


Luke242 October 25th 06 02:10 AM

Changing View to "Search Folder" Upon Start Up
 
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

"Eric Legault [MVP - Outlook]" wrote:

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")


Michael Bauer [MVP - Outlook] October 25th 06 06:14 AM

Changing View to "Search Folder" Upon Start Up
 
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?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --

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")


Luke242 October 25th 06 06:48 AM

Changing View to "Search Folder" Upon Start Up
 
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

"Michael Bauer [MVP - Outlook]" wrote:

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?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --

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")




All times are GMT +1. The time now is 11:08 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com