Powerpoint全局按钮

时间:2016-01-15 14:44:19

标签: vba powerpoint powerpoint-vba

我认为这对于任何具有某种VBA技能的人来说都是一个简单的问题:PowerPoint-pro:

我有一个类似测验的演示文稿,我喜欢在WWTBAM中提供三个笑话。 所以我创建了三个按钮,然后我按下了50:50按钮,点击一个动画开始,这样就隐藏了错误的答案。所以我现在只想,如果你点击一张幻灯片上的小丑按钮,就必须在所有其他幻灯片上删除/禁用/交叉。

有没有人能给我看一个简单的片段呢?

那真的很棒。 谢谢!

1 个答案:

答案 0 :(得分:1)

这应该让你朝着正确的方向前进:

Option Explicit

' The name of the shape(s) to search for
' (name shapes in the Selection Pane : Alt+F10 for PowerPoint 2010 and later)
Public Const ShapeName = "50/50"

' Purpose:  Macro to HIDE all shapes on all slides that match the specified name
' Usage:    Assign to any shape(s) on a slide via the Insert Tab / Action / Mouse Click / Run Macro
' Author:   Jamie Garroch of YOUpresent Ltd. (http://youpresent.co.uk/)
Public Sub HideAll()
  Dim oSld As Slide
  Dim oShp As Shape
  For Each oSld In ActivePresentation.Slides
    For Each oShp In oSld.Shapes
      If oShp.Name = ShapeName Then oShp.Visible = msoFalse
    Next
  Next
End Sub

' Purpose:  Macro to SHOW all shapes on all slides that match the specified name
' Usage:    Assign to any shape(s) on a slide via the Insert Tab / Action / Mouse Click / Run Macro
' Author:   Jamie Garroch of YOUpresent Ltd. (http://youpresent.co.uk/)
Public Sub ShowAll()
  Dim oSld As Slide
  Dim oShp As Shape
  For Each oSld In ActivePresentation.Slides
    For Each oShp In oSld.Shapes
      If oShp.Name = ShapeName Then oShp.Visible = msoTrue
    Next
  Next
End Sub