Programmatically show or hide folder list pane

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to write some code that will automatically close the folder list
when I select the Calendar folder/view, and then show it again when I select
something other than my Calendar. Here is what I have so far based on what
I've found in VB help and this board:

Dim myOlApp As Outlook.Application
Public WithEvents myOlExp As Outlook.Explorer

Public Sub Initialize_Handler()
Set myOlExp = myOlApp.ActiveExplorer
End Sub

Private Sub myOlExp_FolderSwitch()
Select Case myOlExp.CurrentFolder.Name
Case "Calendar"
myOlExp.ShowPane olFolderList, False
Case Else
myOlExp.ShowPane olFolderList, True
End Select
End Sub


It appears I've followed all the instructions given (granted, that's not
much), but I still cannot get this to work. Any help would be greatly
appreciated.

Thanks!
 
What version of Outlook? Here code like that toggles visibility of the
entire Navigation Pane. That's on Outlook 2003.
 
Outlook 2000. I should also say that a while back I had some code that
accomplished this quite well, but something happened and I've lost the file.
Unfortunately I can't remember exactly how I got this to execute.
 
Does this work in the Immediate window of the Outlook VBA project:

Application.ActiveExplorer.ShowPane olFolderList, False

If you click Enter on it?

If you use the BeforeFolderSwitch event and set myOlExp to the NewFolder
object passed in that event handler before you toggle the folder list does
it work? I see nothing that updates that object once it's set to the
original ActiveExplorer.
 
Back
Top