PDA

View Full Version : Please help with VBA in PPT



johnnyexit
09-14-2015, 11:47 PM
Hello people,

I need to make a count up function of days in ppt presentation.
I found code for VBA on google, changet a little bit for my purpose and it works fine.

Now I need your help. Need to insert one button or shape for restarting the date.

'=====KOD=====

Option Explicit

Private Const TIMERLIMIT As Single = 300000000# ' Limit

Sub UpdateCounter()
Dim tStr As String
Dim time2 As Date, time3 As Date
Dim updateTime As Single
Dim startDateTime As Date ' Last accident
Dim delTime As Single
'
startDateTime = "14 03, 2008 "
time2 = Now - startDateTime
time3 = time2
tStr = " " & Format(Int(time3), "000")
ActivePresentation.Slides(1).Shapes("Counter").TextFrame.TextRange.Characters = tStr
'
DoEvents
'
While (Application.SlideShowWindows.Count > 0)
time3 = Now - startDateTime
If ((time3 <> time2)) Then
tStr = " " & Format(Int(time3), "000")
ActivePresentation.Slides(1).Shapes("Counter").TextFrame.TextRange.Characters = tStr
time2 = time3
DoEvents
End If
Wend
End Sub
'=====Kraj=====


So if I press reset button to insert a today date into variable startDateTime!!
Is it possible?
TNX

johnnyexit
09-15-2015, 01:45 AM
Hello people,

I need to make a count up function of days in ppt presentation.
I found code for VBA on google, changet a little bit for my purpose and it works fine.

Now I need your help. Need to insert one button or shape for restarting the date.

'=====KOD=====

Option Explicit

Private Const TIMERLIMIT As Single = 300000000# ' Limit

Sub UpdateCounter()
Dim tStr As String





Dim time2 As Date, time3 As Date
Dim updateTime As Single
Dim startDateTime As Date ' Last accident
Dim delTime As Single
'
startDateTime = "14 03, 2008 "
time2 = Now - startDateTime
time3 = time2
tStr = " " & Format(Int(time3), "000")
ActivePresentation.Slides(1).Shapes("Counter").TextFrame.TextRange.Characters = tStr
'
DoEvents
'
While (Application.SlideShowWindows.Count > 0)
time3 = Now - startDateTime
If ((time3 <> time2)) Then
tStr = " " & Format(Int(time3), "000")
ActivePresentation.Slides(1).Shapes("Counter").TextFrame.TextRange.Characters = tStr
time2 = time3
DoEvents
End If
Wend
End Sub
'=====Kraj=====


So if I press reset button to insert a today date into variable startDateTime!!
Is it possible?
TNX




14394