Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Vba - automaticaly closing userform

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/

  #2   Report Post  
Posted to microsoft.public.excel.programming
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/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform won't show after closing another file Gerry O Excel Discussion (Misc queries) 8 September 7th 07 03:51 PM
Re-show userform after closing file - code help Gerry O Excel Discussion (Misc queries) 3 September 4th 07 10:52 PM
Closing the Userform when macro is running SuperJas Excel Programming 5 December 10th 03 05:31 AM
userform titlebar and closing form D.S.[_3_] Excel Programming 6 November 29th 03 06:26 PM
Help with closing a UserForm Ron de Bruin Excel Programming 0 August 8th 03 01:52 PM


All times are GMT +1. The time now is 08:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"