none
Change Default View of Reading Pane RRS feed

  • Question

  • I do not like the reading pane. Turning it off for one folder does not change any other folder. Adding a new folder or account enables it by default. Is there a way to change this to where the Reading Pane is Off BY DEFAULT? If not, is there a macro that could go through every folder of all of my IMAP/POP3/Exchange accounts and turn them all off?
    Saturday, December 14, 2013 4:46 AM

Answers

  • I finished the macro and it works.

    Sub ReadingPaneOff(ByVal folder As Outlook.folder)
    Dim explorer As Outlook.explorer
    Dim tView As Outlook.TableView
        
        Set explorer = Application.ActiveExplorer()
        Set tView = folder.CurrentView
        
        tView.ShowReadingPane = True
        tView.ShowReadingPane = False
        
        tView.Apply
    End Sub
    
    Sub NoReadingPane()
    
    Dim ns As Outlook.NameSpace
    Dim sts As Outlook.Stores, st As Outlook.Store
    Dim fldr As Outlook.folder, fldrs As Outlook.folders, oRoot As Outlook.folder
    
        Set ns = Outlook.GetNamespace("MAPI")
        Set sts = ns.Stores
        
        For Each st In sts
        
            Set oRoot = st.GetRootFolder
            
            For Each fldr In oRoot.folders
                
                If fldr.DefaultItemType = olMailItem Then
                    
                    Call ReadingPaneOff(fldr)
                    
                End If
            
            Next fldr
        
        Next st
    
    End Sub
    
    Sub CurrentFolderReadingPaneOff()
        
    Dim explorer As Outlook.explorer
        
        Set explorer = Application.ActiveExplorer()
        
        Call ReadingPaneOff(explorer.CurrentFolder)
    
    End Sub
    



    Sunday, December 15, 2013 12:10 AM

All replies

  • Hello Michael,

    You are right, the Reading pane settings can be changed on the per folder basis. There is no global settings. Here is a sample code:

    Outlook.Explorer explorer = null;
    Outlook.Folder folder = null;
    Outlook.TableView tView = null;
    try
    {
       explorer = OutlookApp.ActiveExplorer();
       folder = explorer.CurrentFolder as Outlook.Folder;
       tView = folder.CurrentView as Outlook.TableView;
       tView.ShowReadingPane = false;
       tView.Apply();
    }
    catch(Exception ex)
    { 
        MessageBox.Show(ex.Message);
    }
    finally
    {
       Marshal.ReleaseComObject(tView);
       Marshal.ReleaseComObject(folder);
       Marshal.ReleaseComObject(explorer);
    }

    The TableView class provides the ShowReadingPane property which can be used for displaying or hiding the reading pane. Note, this property was introduced in Outlook 2007.

    In case of earlier versions you can search the windows registry records for the keys that contain the required settings. For example, please take a look at the similar forum thread. The Process Monitor utility can be used for monitoring windows registry.

    Finally, you can handle the FolderAdd event of the Folders class and turn the Reading pane off.

    Saturday, December 14, 2013 9:22 AM
  • Is this code for VBA in Outlook or is it for C++?
    Saturday, December 14, 2013 9:01 PM
  • Here is a VBA macro:

    Public Sub Test()
       Dim explorer As Outlook.explorer
       Dim folder As Outlook.folder
       Dim tView As Outlook.TableView
       
       Set explorer = Application.ActiveExplorer()
       Set folder = explorer.CurrentFolder
       Set tView = folder.CurrentView
       
       tView.ShowReadingPane = False
       tView.Apply
    End Sub
    

    Saturday, December 14, 2013 9:05 PM
  • That works great for the current folder. How do I loop through each folder in all email accounts?
    Saturday, December 14, 2013 10:40 PM
  • I finished the macro and it works.

    Sub ReadingPaneOff(ByVal folder As Outlook.folder)
    Dim explorer As Outlook.explorer
    Dim tView As Outlook.TableView
        
        Set explorer = Application.ActiveExplorer()
        Set tView = folder.CurrentView
        
        tView.ShowReadingPane = True
        tView.ShowReadingPane = False
        
        tView.Apply
    End Sub
    
    Sub NoReadingPane()
    
    Dim ns As Outlook.NameSpace
    Dim sts As Outlook.Stores, st As Outlook.Store
    Dim fldr As Outlook.folder, fldrs As Outlook.folders, oRoot As Outlook.folder
    
        Set ns = Outlook.GetNamespace("MAPI")
        Set sts = ns.Stores
        
        For Each st In sts
        
            Set oRoot = st.GetRootFolder
            
            For Each fldr In oRoot.folders
                
                If fldr.DefaultItemType = olMailItem Then
                    
                    Call ReadingPaneOff(fldr)
                    
                End If
            
            Next fldr
        
        Next st
    
    End Sub
    
    Sub CurrentFolderReadingPaneOff()
        
    Dim explorer As Outlook.explorer
        
        Set explorer = Application.ActiveExplorer()
        
        Call ReadingPaneOff(explorer.CurrentFolder)
    
    End Sub
    



    Sunday, December 15, 2013 12:10 AM