View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default Vba - automaticaly closing userform

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

"ajliaks " skrev i melding
...
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


---
Message posted from http://www.ExcelForum.com/