Vba - automaticaly closing userform

  • Thread starter Thread starter ajliaks
  • Start date Start date
A

ajliaks

Hi all,

i need to close the userform after 2 seconds.
Could anybody help me?
Thanks.

Iam trying something like this:

Private Sub UserForm_Initialize()
Dim cTime As Long
Dim WSH As Object

Set WSH = CreateObject("WScript.Shell")
cTime = 1

Wait cTime '?????

Unload Me
End Sub
 
In a standard module:

Sub ShowForm()
UserForm1.Show
End Sub

Sub KillForm()
Unload UserForm1
End Sub

In the userform1 module:

Private Sub UserForm_Initialize()
Application.OnTime (Now + TimeSerial(0, 0, 2)), "KillForm"
End Sub

HTH. Best wishes Harald
 
Back
Top