Opening Shared folder in new window using vba

ian orr 1 Reputation point

Hello All,
I am trying to open a shared calendar in a new window and I can't quite seem to figure out how to get it done. Information on Outlook VBA is somewhat scarce. I need to be able to open a specific shared calendar of my choice in a new window, but getting a new window to do anything for me is very difficult. I have a couple of links that I am trying to use to work off of but what i have scrapped together is below. I have used Excel VBA for a while now, but this is my first time using it for Outlook so there are a lot of tricks I am not familiar with yet, so thanks for any help.


Sub SelectCalendars()
Dim objPane As Outlook.NavigationPane
Dim objModule As Outlook.CalendarModule
Dim objGroup As Outlook.NavigationGroup
Dim objNavFolder As Outlook.NavigationFolder
Dim F As Outlook.MAPIFolder
Dim objCalendar As Folder
Dim objFolder As Folder

Dim i As Integer

SharedUser = "Shared User"

Set Application.ActiveExplorer.CurrentFolder = Session.GetFolder(olFolderCalendar)

Set objCalendar = Session.GetDefaultFolder(olFolderCalendar)
Set objPane = Application.ActiveExplorer.NavigationPane
Set objModule = objPane.Modules.GetNavigationModule(olModuleCalendar)

With objModule.NavigationGroups
    Set objGroup1 = .GetDefaultNavigationGroup(olMyFoldersGroup)

' To use a different group
    Set objGroup2 = .Item("Other Calendars")
End With

For i = 1 To objGroup2.NavigationFolders.Count
    Set objNavFolder = objGroup2.NavigationFolders.Item(i)
    If  objNavFolder = SharedUser Then
            objNavFolder.IsSelected = True
    Else      'I want to deslelect the rest of the folders
            objNavFolder.IsSelected = False
    End if

'trying to close all other calendars
For i = 1 To objGroup1.NavigationFolders.Count
Set objNavFolder = objGroup1.NavigationFolders.Item(i)
objNavFolder.IsSelected = False

' set the view here

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

End Sub

Outlook Management
Outlook Management
Outlook: A family of Microsoft email and calendar products.Management: The act or process of organizing, handling, directing or controlling something.
4,735 questions
0 comments No comments
{count} votes