Hi,
Have been puzzling this for some time and cannot figure out where to put or structure the code.
I have a 'Welcome' userform that displays for an employee when they enter there employee number in to another userform. What I need is both of the below to be available to close the 'Welcome' userform...
What I cannot overcome with my current code are the below...
Any assistance will be greatly appreciated.
Initial From & Code...
Welcome Screen & Code...
Have been puzzling this for some time and cannot figure out where to put or structure the code.
I have a 'Welcome' userform that displays for an employee when they enter there employee number in to another userform. What I need is both of the below to be available to close the 'Welcome' userform...
- Automatically close the 'Welcome' userform after 10 seconds and revert back to the initial screen
- User can click a command button to close the 'Welcome' userform
What I cannot overcome with my current code are the below...
- Code below errors and does not close the userorm after 10 seconds, the timer only starts once I have closed the 'Welcome' userform and the it errors as the 'Welcome' form is already closed!
- I have to click on the Close button on the 'Welcome' userform to initate the timer to automatically close the 'Welcome' userform!
Any assistance will be greatly appreciated.
Initial From & Code...
VBA Code:
Private Sub TextBox1_Change()
Dim FoundCell As Range
Dim EmpID As String
Set ws = Sheet3
If Me.TextBox1 = "" Then Exit Sub
EmpID = TextBox1.Value * 1
Set FoundCell = ws.Range("D:D").Find(EmpID, LookIn:=xlValues, LookAt:=xlWhole)
If Not FoundCell Is Nothing Then
Welcome.Show
Application.Wait (Now + TimeValue("0:00:10")) '*** Always waits here after I have clicked close on the 'Welcome' userform
Welcome.Hide '*** currently errors here when I click close on the welcome screen as it is already closed!
With Me
.TextBox1.Value = ""
.TextBox1.SetFocus
End With
Else
End If
End Sub
Welcome Screen & Code...
VBA Code:
Private Sub CommandButton1_Click()
Me.Hide
End Sub