Select multiple calendars in Outlook

Last reviewed on September 24, 2013

Applies to Microsoft Outlook 2013, Outlook 2010, Outlook 2007

Use this macro to select multiple calendars and open them in overlay mode. If you are using iCloud and don't want the iCloud calendars selected by default, you can use this method to deselect the iCloud calendars. See Deselect iCloud Calendars for more information and the necessary code.

Use VBA to select calendarsThis code sample assumes that the calendars are all in the My Calendars group.

If the calendars are all in another group, you can use this line to identify the group and select the calendars in it:
Set objGroup = .Item("group name")

In this code sample, I'm opening calendars #1, 3, and 4 in the My Calendars group. To open 2 and 5 (New Stuff and a mailbox Calendar in the screenshot), I'd use Case 2, 5

When you use Outlook 2013 and all of the calendars are in one group, you can select the group to show all.

To use, set macro security to low, open the VBA editor by pressing Alt+F11 then paste this into a new module. Assign it to a ribbon or toolbar button and run. More complete instructions are at How to use the VBA Editor.

Sub SelectCalendars()
    Dim objPane As Outlook.NavigationPane
    Dim objModule As Outlook.CalendarModule
    Dim objGroup As Outlook.NavigationGroup
    Dim objNavFolder As Outlook.NavigationFolder
    Dim objCalendar As Folder
    Dim objFolder As Folder
    
    Dim i As Integer
    
    Set Application.ActiveExplorer.CurrentFolder = Session.GetDefaultFolder(olFolderCalendar)
    DoEvents
    
    Set objCalendar = Session.GetDefaultFolder(olFolderCalendar)
    Set objPane = Application.ActiveExplorer.NavigationPane
    Set objModule = objPane.Modules.GetNavigationModule(olModuleCalendar)
    
    With objModule.NavigationGroups
        Set objGroup = .GetDefaultNavigationGroup(olMyFoldersGroup)

    ' To use a different group
       ' Set objGroup = .Item("group name")
    End With


    For i = 1 To objGroup.NavigationFolders.Count
        Set objNavFolder = objGroup.NavigationFolders.Item(i)
        Select Case i

        ' Enter the calendar index numbers you want to open
            Case 1, 3, 4
                objNavFolder.IsSelected = True
             
        ' Set to True to open side by side
                objNavFolder.IsSideBySide = False
            Case Else
                objNavFolder.IsSelected = False
        End Select
    Next


    Set objPane = Nothing
    Set objModule = Nothing
    Set objGroup = Nothing
    Set objNavFolder = Nothing
    Set objCalendar = Nothing
    Set objFolder = Nothing
End Sub

 

Automatically select specific calendars when switching to the calendar module

If you want to always have certain calendars selected when you switch to the calendar module, you can add an Application_Startup macro to the code. Every time you select the calendar module, the calendars listed in the Case statement will be selected.

To use this macro, add it to ThisOutlookSession. Click in the Application_Startup macro and press Run to enable it without restarting Outlook.

Dim WithEvents objPane As NavigationPane
  
Private Sub Application_Startup()
    Set objPane = Application.ActiveExplorer.NavigationPane
  
End Sub
  
  
Private Sub objPane_ModuleSwitch(ByVal CurrentModule As NavigationModule)

    Dim objPane As NavigationPane
    Dim objModule As CalendarModule
    Dim objGroup As NavigationGroup
    Dim objNavFolder As NavigationFolder
    Dim objCalendar As Folder
    Dim objFolder As Folder
     
    Dim i As Integer
     
    If CurrentModule.NavigationModuleType = olModuleCalendar Then
    Set Application.ActiveExplorer.CurrentFolder = Session.GetDefaultFolder(olFolderCalendar)
    DoEvents
     
    Set objCalendar = Session.GetDefaultFolder(olFolderCalendar)
    Set objPane = Application.ActiveExplorer.NavigationPane
    Set objModule = objPane.Modules.GetNavigationModule(olModuleCalendar)
     
    With objModule.NavigationGroups
        Set objGroup = .GetDefaultNavigationGroup(olMyFoldersGroup)
 
    ' To use a different group
       ' Set objGroup = .Item("group name")
    End With
 
 
    For i = 1 To objGroup.NavigationFolders.Count
        Set objNavFolder = objGroup.NavigationFolders.Item(i)
        Select Case i
 
        ' Enter the calendar index numbers you want to open
            Case 1, 3, 4
                objNavFolder.IsSelected = True
              
        ' Set to True to open side by side
                objNavFolder.IsSideBySide = False
            Case Else
                objNavFolder.IsSelected = False
        End Select
    Next
    End If

    Set objPane = Nothing
    Set objModule = Nothing
    Set objGroup = Nothing
    Set objNavFolder = Nothing
    Set objCalendar = Nothing
    Set objFolder = Nothing

End Sub

 

Deselect iCloud Calendars

Many iCloud users don't appreciate that Apple has all iCloud calendars selected by default when you open Outlook. If you are one of these users, you can use the following code sample to deselect the iCloud calendars. Replace the block of code between With objModule.NavigationGroups and the last End If in the automatic macro above with the code below.

    With objModule.NavigationGroups
        Set objGroup = .Item("iCloud")
    End With
  
  
    For i = 1 To objGroup.NavigationFolders.Count
        Set objNavFolder = objGroup.NavigationFolders.Item(i)
        Select Case i
  
        ' Enter the calendar index numbers you want to close
            Case 1, 2
             If objNavFolder.IsSelected = True Then
                objNavFolder.IsSelected = False
             Else
             End If
        ' we'll deselect any we missed
           Case Else
               objNavFolder.IsSelected = False
        End Select
    Next
    End If

Written by

Diane Poremsky
A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Please post long or more complicated questions at Outlookforums.

4 responses to “Select multiple calendars in Outlook”

  1. Krasimir

    Diane,

    Need help. I cant get an internet published calendar to sync with my private Outlook 13. When I publish it from my company Exchange account all goes well, I log in with my outlook.com account, send invitation to my private email and open the link on my private pc. It retrieves for a while and disappears.. Says "check validity of the link.." Actually all worked till two days ago and when I noticed an error in send/receive just deleted the previous subscription and created a new one. Any idea where the issue is?

    Thanks,

  2. Joel

    Diane,

    Please Help. I am trying to select and unselect calendars from multiple groups using multiple macros. Can this be done?

    Thanks,

Leave a Reply

If the Post Coment button disappears, press your Tab key.