time elapse on userform label caption
Add this code to a standard code module
Public nTime As Long
Public Sub UpdateLabel()
UserForm1.Label3.Caption = Format(nTime, "0 secs")
nTime = nTime - 1
If nTime = 0 Then
Application.OnTime Now() + TimeSerial(0, 0, 1), "UpdateLabel"
Else
UserForm1.Label3.Caption = "Time up"
End If
End Sub
then in your form, activate it with
Private Sub UsrForm_Activate()
nTime = 30
Call UpdateLabel
End Sub
--
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
"pswanie" wrote in message
...
im trying to instead of just showing "system busy. pls wait" to show
"system
busy" "time left **sec's"
this i got from a posting he
Private Sub UserForm_Activate()
Application.OnTime Now + TimeValue("00:00:05"), "KillTheForm"
End Sub
im trying to use this:
Private Sub UserForm_Activate()
Application.OnTime Now + TimeValue("00:00:30"), Label3.Caption.(30sec)
Application.OnTime Now + TimeValue("00:00:20"), Label3.Caption =
"20sec"
Application.OnTime Now + TimeValue("00:00:10"), Label3.Caption =
"10sec"
Application.OnTime Now + TimeValue("00:00:05"), Label3.Caption =
"05sec"
Application.OnTime Now + TimeValue("00:00:05"), "KillTheForm"
End Sub
|