Tom’s Tutorials For Excel: Showing And AutoClosing a UserForm

Tom’s Tutorials For Excel: Showing And AutoClosing a UserForm

Sometimes you might want to only show a UserForm for a brief time, say 5 seconds. For example, you might want to show a quick message that’s custom-formatted beyond what a MessageBox can do, or you want the effect of a splash screen to advertise your work when the workbook opens.

Here’s a way this can be accomplished.

In a standard module to call the userform:
Sub ShowFiveSeconds()
UserForm1.Show
End Sub

In the UserForm module:
Private Sub UserForm_Activate()
Application.Wait Now + TimeSerial(0, 0, 5)
Unload Me
End Sub

Share Button
Posted in Tom's Tutorials for Excel
Tags: , , , , , , , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*