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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

erivien

New Member
Joined
Jan 16, 2004
Messages
21
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!
 

al_b_cnu

Well-known Member
Joined
Jul 18, 2003
Messages
4,526
Hi,

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

HTH

Alan
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,084
Messages
5,857,269
Members
431,867
Latest member
Dalorian

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
Top