When you switch between different sections, no matter Mail, Contacts, Calendar or Tasks, Outlook will always open its default folder. If you want to configure Outlook to always open specific and non-default folders, you can use the method introduced in this article.
As usual, when you switch to Mail section, Outlook will open its default folder in the “Favorites” group. Actually, for the default mail folder, you can easily change it in Outlook Options, like the following screenshot:
But when you move to Calendar or Contacts section, Outlook will open the folder under the default Outlook data file. As for Tasks section, it is the “To-Do List”.
If the default ones in Outlook aren’t your frequently –used folders, you will feel it annoying since that you have to manually open your needed folders every time. In this situation, you must hope that Outlook can always open your frequently –used folders when switching between the different sections. Therefore, here we will teach you how to achieve it with Outlook VBA. We will specify the folders in 4 common sections, namely “Mail”, “Calendar”, “Contacts” and “Tasks”.
Open Specific Folders When Switching Between Outlook Sections
- In the first place, launch Outlook and go to “Developer” tab.
- Then locate and click on “Visual Basic” button.
- In the popup “Microsoft Visual Basic for Applications” window, you ought to open the “ThisOutlookSession” project.
- Next copy and paste the following VBA codes into it.
Public WithEvents olNavPane As NavigationPane Private Sub Application_Startup() Set olNavPane = Outlook.Application.ActiveExplorer.NavigationPane End Sub Private Sub olNavPane_ModuleSwitch(ByVal CurrentModule As NavigationModule) Dim olMailModule As MailModule Dim olCalModule As CalendarModule Dim olConModule As ContactsModule Dim olTaskModule As TasksModule Dim olNavGroup As NavigationGroup Dim olNavFolder As NavigationFolder On Error GoTo ErrorHandler Select Case CurrentModule.NavigationModuleType Case olModuleMail Set olMailModule = olNavPane.Modules.GetNavigationModule(olModuleMail) 'Mail only works in "Favorites" group 'You can add the specific folder to Favrites firstly Set olNavGroup = olMailModule.NavigationGroups("Favorites") '"4" refers to the order of the specific folder in the folder list 'You can replace it as per your needs Set olNavFolder = olNavGroup.NavigationFolders.Item(4) Case olModuleCalendar Set olCalModule = olNavPane.Modules.GetNavigationModule(olModuleCalendar) Set olNavGroup = olCalModule.NavigationGroups("My Calendars") Set olNavFolder = olNavGroup.NavigationFolders.Item(3) Case olModuleContacts Set olConModule = olNavPane.Modules.GetNavigationModule(olModuleContacts) Set olNavGroup = olConModule.NavigationGroups("My Contacts") Set olNavFolder = olNavGroup.NavigationFolders.Item(5) Case olModuleTasks Set olTaskModule = olNavPane.Modules.GetNavigationModule(olModuleTasks) Set olNavGroup = olTaskModule.NavigationGroups("My Tasks") Set olNavFolder = olNavGroup.NavigationFolders.Item(4) End Select olNavFolder.IsSelected = True ErrorHandler: Exit Sub End Sub
- After that, sign this code. Just create a new certificate by the built-in utility “Digital Certificates for VBA Projects”, and then assign the certificate to the current macro.
- Subsequently, change your macro settings to enable digitally signed macros only.
- Later exit the “Visual Basic” window and restart Outlook. Finally, Outlook will open your frequently-used folder according to the codes.
Salvage Your Outlook Data
As we all know, Outlook is vulnerable. Thus you should keep vigilant against all the potential dangers, including viruses, malware, and file oversize and so on. So as to combat against them and protect Outlook data, you should make backups on a regular basis and get hold of Outlook file damage fix utility, like DataNumen Outlook Repair.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including repair SQL mdf database damage and outlook repair software products. For more information visit www.datanumen.com