PKBoBo
07-21-2022, 03:41 AM
I'm hoping somebody is able to explain the reason my counter is being a little weird please! I want to use a dim to store the time to be put into a countdown timer. It mostly works but the first click does nothing then it will kick into gear and work smoothly until it is asked to do a different type of thing. Then it will hold off for one click before doing what I thought it was supposed to do.
My code is below and here is how I expect it to work. I declare a dim called timex which will store how long is to be fed to the countdown clock. If I run the sub add1min() it should increase the timex value by 1. Similarly, sub minus1min() would drop the timex value by one.
My code is
Dim timex
Sub add1min()
timesetx
timex = (timex) + 1
End Sub
Sub minus1min()
timesetx
timex = (timex) - 1
End Sub
Sub resetcountdown()
timex = 0
ActivePresentation.Slides(1).Shapes("timesetx").TextFrame.TextRange = 0
End Sub
Sub countdown()
Dim future As Date
future = DateAdd("s", timex, Now())
Do Until future < Now()
DoEvents
ActivePresentation.Slides(1).Shapes("countdownbox").TextFrame.TextRange = Format(future - Now(), "hh:nn:ss")
Loop
End Sub
Sub timesetx()
ActivePresentation.Slides(1).Shapes("timesetx").TextFrame.TextRange = timex
End Sub
Thanks for any help you can provide,
Peter.
My code is below and here is how I expect it to work. I declare a dim called timex which will store how long is to be fed to the countdown clock. If I run the sub add1min() it should increase the timex value by 1. Similarly, sub minus1min() would drop the timex value by one.
My code is
Dim timex
Sub add1min()
timesetx
timex = (timex) + 1
End Sub
Sub minus1min()
timesetx
timex = (timex) - 1
End Sub
Sub resetcountdown()
timex = 0
ActivePresentation.Slides(1).Shapes("timesetx").TextFrame.TextRange = 0
End Sub
Sub countdown()
Dim future As Date
future = DateAdd("s", timex, Now())
Do Until future < Now()
DoEvents
ActivePresentation.Slides(1).Shapes("countdownbox").TextFrame.TextRange = Format(future - Now(), "hh:nn:ss")
Loop
End Sub
Sub timesetx()
ActivePresentation.Slides(1).Shapes("timesetx").TextFrame.TextRange = timex
End Sub
Thanks for any help you can provide,
Peter.