Home | VBA Section | General Section | Downloads | Licensing | Privacy Policy | OfficeTips RSS Feed

How to activate the tab of choice (Outline/Slides) in PowerPoint 2002 and later

 

You cannot achieve it thru the object model since the ViewType property is read-only when it applies to Panes object. But you can get around it making use of command bar control ID 6015 which toggles between thumbnails and outline view of the pane.

It  appears in the Tools | Customize | Commands | Categories: View, Commands: Show Outline.
 

 
' ---------------------------------------------------------------------
' Copyright ©1999-2009, Shyam Pillai, All Rights Reserved.
' ---------------------------------------------------------------------
' You are free to use this code within your own applications, add-ins,
' documents etc but you are expressly forbidden from selling or
' otherwise distributing this source code without prior consent.
' This includes both posting free demo projects made from this
' code as well as reproducing the code in text or html format.
' You may include acknowledgement to the author and a link to this site.
' ----------------------------------------------------------------------
Sub SetSlideTab()
    Dim oCmdButton As CommandBarButton
    Set oCmdButton = CommandBars("Standard").Controls.Add(Id:=6015)
    DoEvents
    ActiveWindow.ViewType = ppViewNormal
    
    If Not oCmdButton Is Nothing Then
        If ActiveWindow.Panes(1).ViewType = ppViewOutline Then
            oCmdButton.Execute
        End If
        oCmdButton.Delete
        Set oCmdButton = Nothing
    End If
End Sub
Sub SetOutlineTab()
    Dim oCmdButton As CommandBarButton
    Set oCmdButton = CommandBars("Standard").Controls.Add(Id:=6015)
    DoEvents
    ActiveWindow.ViewType = ppViewNormal
    
    If Not oCmdButton Is Nothing Then
        If ActiveWindow.Panes(1).ViewType = ppViewThumbnails Then
            oCmdButton.Execute
        End If
        oCmdButton.Delete
        Set oCmdButton = Nothing
    End If
End Sub
 
 

Copyright © 1999-2009 Shyam Pillai. All rights reserved.