0

我正在尝试在 PowerPoint 中编写一个基本上是 IF 语句的宏。我有 4 个盒子,我有动画,当它们被点击时,它们会淡出。是否有可能有一个宏识别所有 4 个框何时都消失,然后淡入第五个框?

所以 4 个框在用户控制下消失,然后一旦它们都消失了,第五个会自动出现。这可能吗?

4

2 回答 2

0

不需要vba。给第五个动画你喜欢的任何动画,然后将其设置为 After Previous。如果需要,添加延迟。它会在前一个(即第四个形状)消失后动画。

于 2013-03-19T03:46:08.470 回答
0

Ah. Thanks for clarifying.

Here you go:

' Give each of the four shapes an action setting of Run Macro:  HideMe

Sub HideMe(oSh As Shape)
    Dim oSl As Slide

    ' hide the clicked shape
    oSh.Visible = False

    ' test to see if all four shapes are hidden now
    ' edit to reflect the actual names of the shapes in use

    Set oSl = oSh.Parent    ' the slide containing the clicked shape
    With oSl
        If Not .Shapes("Rectangle 3").Visible Then
            If Not .Shapes("Rectangle 4").Visible Then
                If Not .Shapes("Rectangle 5").Visible Then
                    If Not .Shapes("Rectangle 6").Visible Then
                        ' they're all hidden, so make the new shape visible
                        .Shapes("Rectangle 7").Visible = True
                    End If
                End If

            End If
        End If
    End With

End Sub

Sub MakeMeInvisible()
' run this after selecting the final shape
' to make it invisible to begin with
    ActiveWindow.Selection.ShapeRange(1).Visible = False
End Sub
于 2013-03-20T17:51:18.677 回答