The following code opens Animation Pane in Power Point Application.
Application.CommandBars.FindControl(Id:=730, Type:=1).Execute
I want to open Animation Pane if Animation Pane is not already open.
When the Animation Pane is visible, the "Animation Pane" button on the Ribbon/Command Bar displays as toggled-on. This maps to its State property, which is an MsoButtonState enum
| Name | Value | Description |
|---|---|---|
msoButtonDown |
-1 |
Button is Down, or Toggled On |
msoButtonUp |
0 |
Button is Up, or Toggled Off |
msoButtonMixed |
2 |
Button is Down (alternate) |
You can either check if the State is msoButtonUp / 0, or is not msoButtonDown / -1 before you Execute it:
If Application.CommandBars.FindControl(Id:=730, Type:=1).State=msoButtonUp Then Application.CommandBars.FindControl(Id:=730, Type:=1).Execute
' Or
With Application.CommandBars.FindControl(Id:=730, Type:=1)
If .State = msoButtonUp Then .Execute
End With