倒计时,我找了很久了。谢谢。 Sub Timer()
Dim TDuration As Long
Dim xtime As Date
xtime = Now
Const THour = 1
Const TMin = 30
TDuration = THour * 60 * 60 + TMin * 60
ActivePresentation.Slides(1).Shapes("Date").TextFrame.TextRange.Text = FormatDateTime(Date, 1)
If THour > 0 Then
ActivePresentation.Slides(1).Shapes("Duration").TextFrame.TextRange.Text = Trim(Str(THour)) + " h " + Trim(Str(TMin)) + " min"
Else
ActivePresentation.Slides(1).Shapes("Duration").TextFrame.TextRange.Text = Str(TMin) + " min"
End If
Do While (TDuration > -1)
DoEvents
ActivePresentation.Slides(1).Shapes("Time").TextFrame.TextRange.Text = Format(TimeValue(Format(Now, "hh:mm:ss")))
If Format(Now, "ss") <> Format(xtime, "ss") Then
xtime = Now
ActivePresentation.Slides(1).Shapes("TimeLeft").TextFrame.TextRange.Text = Format(TimeValue(Format(Now, "hh:mm:ss")) - _
TimeSerial(Hour(Now), Minute(Now), Second(Now) + TDuration), "hh:mm:ss")
TDuration = TDuration - 1
End If
Loop
End Sub 我做了数十个ppt交互实例,但那都是用控件的,绘图工具中的文本框也能这么用,开了眼界。 有个问题能解答一下吗? ("Date").("Duration").,这是怎么命名的?不像控件里的属性那样可以修改啊。 我添加一个文本框,录制一个宏,里面有这么一句:ActiveWindow.Selection.SlideRange.Shapes("Text Box 2").Select,("Text Box 2").这种名字也可以改?怎么改? |