我使用以下代码进行了倒计时,在幻灯片放映模式下,该倒计时可以跨越10张幻灯片。我将形状放置在SlideMaster布局中。
Dim time As Date
Dim count As Integer
time = Now()
count = 30
time = DateAdd("s", count, time)
Do Until time < Now
DoEvents
With ActivePresentation.Designs(2).SlideMaster.CustomLayouts(2).Shapes("Counter").TextFrame.TextRange
.Text = Format((time - Now()), "hh:mm:ss")
End With
Loop
Setup SASL/PLAIN for inter-broker communication
Setup SASL/PLAIN for Broker-Zookeeper communication
And Setup SASL/OAUTHBEARER for client-broker communication.
如果未将它们放置在SlideMaster布局中,则这两种代码都可以正常工作。
还有其他方法可以跨多个幻灯片进行倒计时吗?
答案 0 :(得分:1)
使用Format (Now(), "hh:mm:ss")
要创建倒计时,我们需要两个值:
Dim time As Date
Dim count As Integer
time = Now() 'the current time
count = 30
time = DateAdd("s", count, time) 'the future time after 30 seconds
上面提供了两个值。
现在,我们可以循环更改Counter
形状内的文本。
Do Until time < Now() 'We change text until the present time passes the set "future time"
DoEvents
For i = 1 To 10 'Assuming you want the countdown in slides 1 To 10
With ActivePresentation.Slides(i).Shapes("countdown").TextFrame.TextRange
.Text = Format((time - Now()), "hh:mm:ss")
End With
Next i
Loop
您可以使用它在多个幻灯片之间进行倒计时。
答案 1 :(得分:0)
我模仿了类似的代码:
Set Shape = Application.ActivePresentation.Designs(1).SlideMaster.CustomLayouts(1).Shapes("Testing")
Shape.TextFrame.TextRange.Text = "Did it work"
正如您所发现的,虽然幻灯片放映后会更新基础幻灯片母版,但在演示幻灯片时形状的文本并没有改变。但是,我发现通过在此代码之后包含以下内容,它可以按预期工作:
Shape.Visible = msoTrue