This article 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 object:
Private Sub Workbook_Open()
Insert the following subroutine into the code module for UserForm1:
Private Sub UserForm_Activate()
Application.OnTime Now + TimeValue("00:00:05"), "KillTheForm"
Insert the following subroutine into a normal VBA module:
Private Sub KillTheForm()
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.