我在PowerPoint中進行循環演示,我需要倒計時到特定日期。超出範圍錯誤,vba ppt
當使用代碼下面我得到以下錯誤:
運行時錯誤「-2147024809(80070057)」: 指定的值超出範圍。
Sub Countdown()
Dim thedate As Date
Dim daycount As Long
Dim Icount As Integer
Icount = ActivePresentation.Slides(1).Shapes.Count - 1
thedate = "25/12/2013"
daycount = DateDiff("d", Now, thedate)
Select Case daycount
Case Is > 1
ActivePresentation.Slides(1).Shapes(Icount) _
.TextFrame.TextRange = daycount & " Days to go!"
Case Is = 1
ActivePresentation.Slides(1).Shapes(Icount) _
.TextFrame.TextRange = daycount & " Day to go!"
Case Else
ActivePresentation.Slides(1).Shapes(Icount) _
.TextFrame.TextRange = "It's here!"
End Select
End Sub
請幫幫我!
哪一行,你得到錯誤?你有多少張幻燈片?嘗試將'thedate'更改爲'2013-12-25' ...嘗試在所有'.TextRange'之後添加'.Text'屬性... –