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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 06:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com