Is it possible to Program in VB so that program wait for 10 seconds for user input? If no input entered, Program process with default value after 10 seconds. If yes, then how to program.
Asked
Active
Viewed 753 times
-2
-
1You have to write your own "Inputbox" with a timer (just bild a form). But consider: It may last longer than your timeout, if someone is slow on entering data. so reset the timeout each time a key is pressed. – nabuchodonossor Jun 06 '18 at 06:47
-
have you tried something? – Shivani Katukota Jun 06 '18 at 06:51
1 Answers
0
In your form code:
Private Sub UserForm_Activate()
Application.OnTime Now + TimeValue("00:00:10"), "closeIfNoValueEntered"
End Sub
closing procedure:
Sub closeIfNoValueEntered()
If UserForm1.TextBox1.Text = "" Then Unload UserForm1
End Sub
this procedure must be placed in a separate module, not in userform module .

avb
- 1,743
- 1
- 13
- 23