Hello:
I came across this code and would like to try it, but I get a Compile Error: User-defined type not defined on the second line of the code which reads Dim WithEvents CountdownTimer as TMTimer.clsTimer. This code is suppose to work like a splash screen with
a countdown timer that lets the user know when the form will shut down. Thank you for your help!
Option Explicit
Dim WithEvents CountdownTimer As TMTimer.clsTimer
Private Sub CountdownTimer_CountdownComplete()
Unload Me
End Sub
Private Sub CountdownTimer_TimerTick(TimerVal As Single)
Me.Label1.Caption = "This form will close in " _
& Round(CountdownTimer.CurrentMilliSecsLeft / 1000, 0) & " seconds"
End Sub
Private Sub startCounter()
Set CountdownTimer = TMTimer.createTimer
With CountdownTimer
.CountdownDurationMilliSecs = 10 * 1000
.TickIntervalMilliSecs = 3 * 1000
.TimerType = .TimerTypeCountdown
.startTimer
End With
End Sub
Private Sub Cancel_Click()
CountdownTimer.cancelTimer
Unload Me
End Sub
Private Sub OK_Click()
MsgBox "OK"
CountdownTimer.cancelTimer
Me.Hide
End Sub
Private Sub Reset_Click()
CountdownTimer.resetCountdown
End Sub
Private Sub UserForm_Activate()
startCounter
End Sub