Private Sub CreateImportantFavoritesFolder()
Dim objNamespace As NameSpace
Dim objCalendars As Folder
Dim objFolder As Folder
Dim objPane As NavigationPane
Dim objModule As MailModule
Dim objGroup As NavigationGroup
Dim objNavFolder As NavigationFolder
On Error GoTo ErrRoutine
' First, retrieve the default Inbox folder.
Set objNamespace = Application.GetNamespace("MAPI")
Set objCalendars = objNamespace.GetDefaultFolder(olFolderInbox)
' Create a new mail folder named "Important Items".
Set objFolder = objCalendars.Folders.Add("Important Items")
' Get the NavigationPane object for the
' currently displayed Explorer object.
Set objPane = Application.ActiveExplorer.NavigationPane
' Get the mail module from the Navigation Pane.
Set objModule = objPane.Modules.GetNavigationModule(olModuleMail)
' Get the "Favorite Folders" navigation group from the
' mail module.
With objModule.NavigationGroups
Set objGroup = .GetDefaultNavigationGroup(olFavoriteFoldersGroup)
End With
' Add a new navigation folder for the "Important Items"
' folder in the "Favorite Folders" navigation group.
Set objNavFolder = objGroup.NavigationFolders.Add(objFolder)
With objNavFolder.Folder
.WebViewURL = "http://www.google.com"
.WebViewOn = True
End With
EndRoutine:
On Error GoTo 0
Set objNavFolder = Nothing
Set objFolder = Nothing
Set objGroup = Nothing
Set objModule = Nothing
Set objPane = Nothing
Set objNamespace = Nothing
Exit Sub
ErrRoutine:
MsgBox Err.Number & " - " & Err.Description, _
vbOKOnly Or vbCritical, _
"CreateImportantFavoritesFolder"
End Sub