User Form close buttons and timer close 
Author Message
 User Form close buttons and timer close

Hi I have a User Form splash screen that presents on WoekBook open.
There is a button to close the form. However, I want the form to
automatically close after 10 seconds if the button is not pressed.

I had code that worked in 2000, but in 97 does not. Now I need to make code
work in both. I have something that works but does not allow me to use the
close buttons, it just freezes the window until 10 seconds when it closes.

Private Sub UserForm_Activate()
    Dim newHour, newMinute, newSecond, waitTime
    Me.spTimer.Caption = "This window will close in 10 seconds"
    newHour = Hour(Now())
    newMinute = Minute(Now())
    newSecond = Second(Now()) + 10
    waitTime = TimeSerial(newHour, newMinute, newSecond)

    Application.Wait waitTime
    Unload Me
End Sub

Private Sub spSplashProceed_Click()
    Unload Me
End Sub



Tue, 01 Nov 2005 05:56:02 GMT  
 User Form close buttons and timer close
Hi Christopher,

I think you have to use OnTime function like made for the "VBA MsgBox with
timer". Get it and see its code at this site:

http://cpap.com.br/orlando

HTH

---

(So that you get best and rapid solution and all may benefit from the
discussion, please reply within the newsgroup, not in email)



Quote:
> Hi I have a User Form splash screen that presents on WoekBook open.
> There is a button to close the form. However, I want the form to
> automatically close after 10 seconds if the button is not pressed.

> I had code that worked in 2000, but in 97 does not. Now I need to make
code
> work in both. I have something that works but does not allow me to use the
> close buttons, it just freezes the window until 10 seconds when it closes.

> Private Sub UserForm_Activate()
>     Dim newHour, newMinute, newSecond, waitTime
>     Me.spTimer.Caption = "This window will close in 10 seconds"
>     newHour = Hour(Now())
>     newMinute = Minute(Now())
>     newSecond = Second(Now()) + 10
>     waitTime = TimeSerial(newHour, newMinute, newSecond)

>     Application.Wait waitTime
>     Unload Me
> End Sub

> Private Sub spSplashProceed_Click()
>     Unload Me
> End Sub



Wed, 02 Nov 2005 23:46:49 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Prevent user from closing form using caption close button

2. Disable Access Close Button not Form Close Button?

3. User form Button not running code until form closes

4. Cancel/close form command button causes app to close

5. Close command button allows form to be closed when required fields are left blank

6. Problem with Controlled Closing of a Form when exiting throught the Window-Close-Button

7. Form Close Vs Close Window button problem

8. Close button, closes form to the wrong place

9. Cancel/close form command button causes app to close

10. React differently to user close form and to docmd.close


 
Powered by phpBB® Forum Software © phpBB Group