ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automatically close a userform (https://www.excelbanter.com/excel-programming/312225-automatically-close-userform.html)

ForSale[_53_]

Automatically close a userform
 

The following isn't working. what am i doing wrong?

UserForm2.Show
Application.Wait (Now() + TimeValue("0:00:04"))
Unload UserForm2

I'm trying to pop up a userform for 4 seconds, then close it.
I initally added some basic shapes - a rectangle and three arrows - an
did the same thing. it worked the first time, but then they wouldn'
pop up anymore, but that's not important.
thanks

--
ForSal
-----------------------------------------------------------------------
ForSale's Profile: http://www.excelforum.com/member.php...fo&userid=1189
View this thread: http://www.excelforum.com/showthread.php?threadid=26566


Bob Phillips[_6_]

Automatically close a userform
 
The Wait will not execute until the form unloads when it is inline. Put that
code in the Userform Activate event of the userform

Private UserForm_Activate()
Application.Wait (Now() + TimeValue("0:00:04"))
Unload UserForm2
End Sub

--

HTH

RP

"ForSale" wrote in message
...

The following isn't working. what am i doing wrong?

UserForm2.Show
Application.Wait (Now() + TimeValue("0:00:04"))
Unload UserForm2

I'm trying to pop up a userform for 4 seconds, then close it.
I initally added some basic shapes - a rectangle and three arrows - and
did the same thing. it worked the first time, but then they wouldn't
pop up anymore, but that's not important.
thanks.


--
ForSale
------------------------------------------------------------------------
ForSale's Profile:

http://www.excelforum.com/member.php...o&userid=11896
View this thread: http://www.excelforum.com/showthread...hreadid=265660





All times are GMT +1. The time now is 08:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com