Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

October 23, 2000 12:00 AM

Opening Folders When Outlook Starts

Windows IT Pro
InstantDoc ID #15730
Rating: (0)
Downloads
15730.zip

One annoying aspect of Microsoft Outlook is that its user interface (UI) doesn't always behave consistently. For example, open the Inbox and Calendar folders in separate windows. Then, close Outlook by clicking File, Exit and Log Off. When you restart Outlook, the separate Inbox and Calendar windows reopen. Now, try the same operation with the Inbox and a Microsoft Exchange Server public folder in separate windows. When you restart Outlook, Outlook doesn't remember that the public folder was open and instead displays the Inbox folder in the extra window.

This annoyance is a prime target for an Outlook 2000 VBA routine that runs when Outlook starts. The routine depends on a shortcut group on the Outlook Bar that contains shortcuts to the folders you want to open when Outlook starts—similar to the Startup group on the Programs menu. Right-click the Outlook Bar, and choose Add New Group. Name the group Startup Folders. Add to the Startup Folders group any folders (besides the Inbox) that you want to appear when Outlook starts.

Now, add the code you see in Listing 1 to your Outlook VBA project's built-in ThisOutlookSession module. This code for the Application_Startup event handler runs the ShowMyFolders subroutine (which you see in Listing 2), then makes the most recently loaded window the active window. This window is either the Inbox or another default folder that you have set to open when Outlook starts.

Put the code in Listing 2 in the ThisOutlookSession module or in a separate module. The ShowMyFolders procedure checks for the existence of a Startup Folders group. If it finds one, it uses the TypeName() function to test whether each shortcut in the group represents a MAPIFolder object (i.e., an Outlook folder). For Web URL shortcuts on the Outlook Bar, TypeName() returns "String"; for system folder shortcuts, the function returns "Object". The code ignores any shortcuts to system folders or Web pages because Outlook doesn't provide a programmatic method to display a non-Outlook folder in an Outlook window.

You can customize Listing 2's code in two ways. First, you can control which navigation panes Outlook displays in the Explorer window. By supplying the Add method's second argument with the intrinsic constant olFolderDisplayNoNavigation, Listing 2's code sets the window to show neither the Outlook Bar nor the folder list. Other possible values are olFolderDisplayFolderOnly (i.e., show the folder list) and olFolderDisplayNormal (i.e., show the Outlook Bar).

You can also customize the state of the Explorer window. Listing 2's code minimizes the window:

objExpl.WindowState =   olMinimized

The other choices besides olMinimized are olMaximized and olNormalWindow.

After you add this code to your VBA project, whenever you start Outlook, separate windows will open for each of the Outlook folders in the Startup Folders group on the Outlook Bar. By the way, if you want Outlook to start in a default folder other than the Inbox, choose Tools, Options, then switch to the Other tab and click Advanced Options. You'll see the Startup in this folder list at the top of the dialog box.

Related Content:

ARTICLE TOOLS

Comments
  • F van Wensen
    9 years ago
    Dec 17, 2003

    Can you maybe help me? I would like to know how to adjust Outlook so that when opening outlook it will open automatically with inbox, without me first select inbox. With Outlook 97 it is very easy, but with 2000 I can not find out how to change it.

    Regards,

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.