Search code examples
vbapowerpointpowerpoint-2010powerpoint-2007powerpoint-2013

How to activate (make visible / enable / show) Selection Pane in PowerPoint using VBA?


In PowerPoint 2013, the Selection pane properties are available from a CommandBar object as follows:

Application.CommandBars("Selection")

(note that for PowerPoint 2010 and 2007 the name is "Selection and Visibility")

When using Alt+F10 in the UI to show the Selection Pane, the following two properties are toggled to true:

Application.CommandBars("Selection").Visible
Application.CommandBars("Selection").Enabled

However, when attempting to set these to true programmatically, the .Visible=True statement causes an unspecified automation error to occur and the .Enabled=True statement executes but doesn't change the state of this property.

But, and this is the weird part, if Alt+F10 is used to show and hide the Selection Pane when PowerPoint first runs, the two lines of code work! I checked all the properties before and after Alt+F10 and only the .Visible and .Enabled ones are toggled.

How can I show the Selection Pane reliably and preferably without having to go down the SendKeys route?


Solution

  • If you just want to show it try:

        If Not CommandBars.GetPressedMso("SelectionPane") Then CommandBars.ExecuteMso ("SelectionPane")