Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
time elapse on userform label caption
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
time elapse on userform label caption
do i take my other time code out? or just add it to urs?
if i use ur code only i dont get any reaction on my userform. it does not update label3 nor close the userform "Bob Phillips" wrote: 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
time elapse on userform label caption
Ditch your code.
I didn't add code to close the form, you will need to add that. The code assumes that the form is called Userform1. -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "pswanie" wrote in message ... do i take my other time code out? or just add it to urs? if i use ur code only i dont get any reaction on my userform. it does not update label3 nor close the userform "Bob Phillips" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Show real time in Userform caption | Excel Programming | |||
Change label caption on userForm while code runs | Excel Programming | |||
Changing label caption in a Userform to an opterator value | Excel Programming | |||
Userform - Label Caption - How to update from a variable | Excel Programming | |||
Label Caption Just Wont Work on UserForm | Excel Programming |