我在PowerPoint演示文稿中使用了一些VBA。我试图做到这一点,以便当我单击幻灯片上的一个按钮时,相对的文本框也将以1.5秒的增量逐个显示。我可以通过它使文本框显示出来,但是它们全部都立即显示出来,而不是像编码那样递增。
Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal Milliseconds As LongPtr)
Sub Highlight(location As String, L1 As String, L2 As String)
If (ActivePresentation.Slides("Round1").Shapes(location).TextFrame.TextRange.Text = L1 Or ActivePresentation.Slides("Round1").Shapes(location).TextFrame.TextRange.Text = L2) Then
Sleep 1500 'Works but all at once?
hilighted = "Blue " + location
ActivePresentation.Slides("Round1").Shapes(hilighted).Visible = True
End If
End Sub
Sub ShowB()
ActivePresentation.Slides("Round1").Shapes("LetterB").Visible = False
' Show Highlight
Highlight "B1", "B", "b"
Highlight "C1", "B", "b"
Highlight "D1", "B", "b"
End Sub
我不确定为什么它的表现不如预期。