Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Show real time in Userform caption Henrich Excel Programming 0 July 13th 06 04:26 PM
Change label caption on userForm while code runs Sliman Excel Programming 1 March 16th 06 05:38 PM
Changing label caption in a Userform to an opterator value jumpjump Excel Programming 2 August 25th 05 01:50 AM
Userform - Label Caption - How to update from a variable Alan Excel Programming 3 August 2nd 04 04:39 AM
Label Caption Just Wont Work on UserForm K[_3_] Excel Programming 2 September 15th 03 03:29 PM


All times are GMT +1. The time now is 07:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"