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 :)
 

Some videos you may like

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

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,494
Hi,

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

HTH

Alan
 

Watch MrExcel Video

Forum statistics

Threads
1,122,719
Messages
5,597,734
Members
414,170
Latest member
Mdm

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