如何基于PowerPoint中的计算使形状可见

时间:2018-10-18 06:05:01

标签: vba powerpoint

我有一个PowerPoint测验,可以计算分数。如果分数高于80%,我希望看到一个按钮(名称为“ PrintCert”的形状),以便用户可以打印证书。当前,该按钮始终可见。这是我尝试失败的代码。 (代码的第一部分和最后一部分更新标签。)

Sub showresult()
Percentage.Caption = Int((CA.Caption) * 100 /     (TQ.Caption)) & "%"
With ActivePresentation.Slides(37)
If ((CA.Caption) * 100 / (TQ.Caption)) > 79.9 Then
.Shapes("PrintCert").Visible = True
Else
.Shapes("PrintCert").Visible = False
End If
End With
SlideLayout41.PercentageCertificate.Caption = Percentage.Caption
ActivePresentation.SlideShowWindow.View.Next
End Sub

1 个答案:

答案 0 :(得分:1)

最简单的方法可能是添加一个新的第一张幻灯片,其中包含用户单击以开始演示的“开始放映”操作按钮。您将对按钮应用“运行宏”操作设置,并使其运行如下宏:

Sub StartShow()

    ' set your button shapes to be invisible
    With SlideShowWindows(1).Presentation.Slides(37)
        .Shapes("PrintCert").Visible = False
    End With
    ' etc, for any other shapes you want to have
    ' hidden to start with

    ' go to the actual first slide
    SlideShowWindows(1).View.GotoSlide (2)

End Sub
相关问题