How to Auto Overlay Specific Calendars When Switching to Outlook Calendar Area

If you desire to keep some specific calendars overlaid when you switch to calendar area in your Outlook, you can refer to this article. We will share you a piece of VBA code. It can help you realize it with effortless ease.

To view several calendars at the same time in your Outlook, you can overlay the calendars. In this way, all appointments and meetings of these overlaid calendars will be shown in one page, but in different colors. Unquestionably, it’s very handy. Thus, if you would like to keep several calendars overlaid whenever you shift to the calendar area, you can use the following method to get it.

Auto Overlay Specific Calendars When Switching to Outlook Calendar Area

Auto Overlay Specific Calendars When Switching to Calendar Area

  1. To start with, launch your Outlook program.
  2. Then press “Alt + F11” key buttons in the main Outlook window.
  3. Next you will get access to the Outlook VBA editor, in which you need to find and open the “ThisOutlookSession” project.
  4. After that, you ought to copy the following VBA code into this project.
Public WithEvents objNavigationPane As NavigationPane
 
Private Sub Application_Startup()
    Set objNavigationPane = Application.ActiveExplorer.NavigationPane
End Sub
 
Private Sub objNavigationPane_ModuleSwitch(ByVal CurrentModule As NavigationModule)
    Dim objCurrentView As Outlook.View
    Dim objCalendarModule As CalendarModule
    Dim objNavigationGroup As NavigationGroup
    Dim objNavigationFolder As NavigationFolder
 
    Set objCurrentView = Application.ActiveExplorer.CurrentView
 
    On Error Resume Next
    'Change the current view of "Calendar" folder to "Calendar"
    If objCurrentView.Name <> "Calendar" Then
       Application.ActiveExplorer.CurrentFolder.Views("Calendar").Apply
    End If
 
    'When switching to "Calendar" area
    If CurrentModule.NavigationModuleType = olModuleCalendar Then
       Set objCalendarModule = objNavigationPane.Modules.GetNavigationModule(olModuleCalendar)
 
       Set objNavigationGroup = objCalendarModule.NavigationGroups.GetDefaultNavigationGroup(olMyFoldersGroup)
  
       For i = 1 To objNavigationGroup.NavigationFolders.count
 
           Set objNavigationFolder = objNavigationGroup.NavigationFolders.Item(i)
 
           Select Case i
                  'Change calendar index numbers you want to open
                  Case 1, 2, 3, 5
                       objNavigationFolder.IsSelected = True
                       'Overlay the specific Calendar folders
                       objNavigationFolder.IsSideBySide = False
                  Case Else
                       objNavigationFolder.IsSelected = False
           End Select
      Next
    End If
End Sub

VBA Code - Auto Overlay Specific Calendars When Switching to Outlook Calendar Area

  1. Subsequently, you have to sign this code. Hit the “Tools” button in the toolbar and choose “Digital Signature” option from the drop down list.
  2. In the popup dialog box, you can follow the onscreen instructions to achieve it.
  3. Later you can change Outlook macro settings to permit the signed macros.
  4. Eventually, you can restart your Outlook application.
  5. From now on, every time when you switch to the “Calendar” area, the specific calendars will be overlaid, like the screenshot below:Overlay vs Not Overlay

Retrieve Data from Damaged Outlook File

Outlook is widely used no matter among individuals or businesses. But, even so, it still cannot be exempt from errors and crashes. If your Outlook frequently gets crashed, your Outlook PST data will be susceptible to damage. At that time, what you can firstly resort to is the inbox repair tool – Scanpst.exe. If unfortunately it fails, you have no choice but to take recourse to a robust external repair utility, such as DataNumen Outlook Repair, which can restore your PST data with utmost ease.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including sql corruption and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.