Creating A Splash Screen For An Excel Workbook
This tip describes how to create a splash screen for a Excel workbook. A splash screen appears when the workbook is opened and disappears automatically after a specific time has elapsed.
Setting it up
Follow these instructions to create a splash screen for your project.
- Create your workbook as usual.
- Activate the Visual Basic Editor and insert a new UserForm into the project. The code here assumes this form is named UserForm1.
- Place any controls you like on UserForm1. For example, you may want to insert an Image control that has your company's logo. Also, you may want to set the UserForm's Caption property to an empty string.
- Insert the following subroutine into the code module for the ThisWorkbook
Private Sub Workbook_Open() UserForm1.Show End Sub
- Insert the following subroutine into the code module for UserForm1:
Private Sub UserForm_Activate() Application.OnTime Now + TimeValue("00:00:05"), "KillTheForm" End Sub
- Insert the following subroutine into a normal VBA module:
Private Sub KillTheForm() Unload UserForm1 End Sub
How it works
When the workbook is opened, the Workbook_Open subroutine is executed. This subroutine displays the UserForm. When the UserForm is displayed, it's Activate event occurs - which triggers the UserForm_Activate subroutine. This subroutine uses the OnTime method of the Application object to execute a subroutine (named KillTheForm) at a particular time. In this case, the time is five seconds from the current time (change this interval by modifying the argument for the TimeValue function). The KillTheForm subroutine simply unloads the UserForm.
Excel has a long history, and it continues to evolve and change. Consequently, the tips provided here do not necessarily apply to all versions of Excel.
In particular, the user interface for Excel 2007 (and later), is vastly different from its predecessors. Therefore, the menu commands listed in older tips, will not correspond to the Excel 2007 (and later) user interface.
Browse Tips by Category
Search for Tips
Needs tips? Here are two books, with nothing but tips:
Contains more than 200 useful tips and tricks for Excel 2007 | Other Excel 2007 books | Amazon link: John Walkenbach's Favorite Excel 2007 Tips & Tricks