-2

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.

Community
  • 1
  • 1
Rajesh
  • 1

1 Answers1

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