vba form problem

erivien

New Member
Joined
Jan 16, 2004
Messages
21
ok I have a vba splash form, on it i have a label named startingin

I have made a code to count down from 5 and then close the form.
It works ok but i would like the startingin label to also count down. At the moment it is stays at 5 for 5 seconds and then closes :(

Code:
Private Sub UserForm_Activate()
    NewHour = Hour(Now())
    newMinute = Minute(Now())
    startingin = 5
    Do Until startingin = 0
        newSecond = Second(Now()) + 1
        Application.Wait TimeSerial(NewHour, newMinute, newSecond)
        startingin = startingin - 1
    Loop
    Unload fsplash
End Sub
how can i fix this?
help is appreciated :)
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
the label was called startingin too.
I have tried with the caption and it just sets it to 5 from #
and wont change it anymore...

I have now changed the label name and neatened up the code a bit:
Code:
Private Sub UserForm_Activate()
    Dim startingin As Integer, newHour As Integer, newMinute As Integer, newSecond As Integer
    newHour = Hour(Now())
    newMinute = Minute(Now())
    startingin = 5
    Do Until startingin = 0
        lstart.Caption = startingin
        newSecond = Second(Now()) + 1
        Application.Wait TimeSerial(newHour, newMinute, newSecond)
        startingin = startingin - 1
    Loop
    Unload fsplash
End Sub

Its still not working properly though!
 
Upvote 0
Hi,

Would it work if you put
DoEvents
just after the lstart.Caption = startingin

HTH

Alan
 
Upvote 0

Forum statistics

Threads
1,214,255
Messages
6,118,508
Members
448,830
Latest member
Drew Terp

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top