Home > VBA Excel Programming > Easy Excel VBA Tutorial: How to Make a Simple Splash Screen for Excel Workbook using VBA

Easy Excel VBA Tutorial: How to Make a Simple Splash Screen for Excel Workbook using VBA

It is actually very simple to create a splash screen for your Excel workbook. Just follow the steps below:

1. Create the User Form

In Excel hit Alt-F11 to bring up the Visual Basic Editor. In the Project Explorer Window, right click on your project, select Insert > User Form. I recommend you rename the user form something like “SplashScreen” in the Properties box. Drag an Image control from the toolbox onto your user form. In the Properties, select the cell next to “Picture” and click on the button with the “…”. This will allow you to select your image. Resize the image and form to your heart’s content.

2. Set Up the Splash Screen

Right-click on your user form and select “View Code”. It should automatically create a sub routine that looks like this:

Private Sub SplashScreen_Click()
End Sub

Change that code so that it looks like the following (or just add the following code below it):

Private Sub UserForm_Initialize()

Application.OnTime Now + TimeValue(“00:00:02″), “KillForm”

End Sub

[Brief explanation - this is the Initialize sub routine that is called whenever the user form opens. Application.OnTime means "Do what I tell you when I tell you to do it". The "Now + TimeValue("00:00:02")" is the when - basically do it right now plus 2 additional seconds, or "wait two seconds to do it". The "KillForm" just tells the form to disappear. To sum it up, this sub is just making the form disappear 2 seconds after it is launched.]

Feel free to change the duration that the splash screen stays visible by changing the 00:00:02 to something else.

3. Show the Splash Screen at Launch

In the Project Explorer Window (we’re still in the Visual Basic Editor), open the file called “ThisWorkbook”. It will most likely be empty if you have not previously added code here. Enter the following code, but change “SplashScreen” to be whatever you named your user form:

Private Sub Workbook_Open()

SplashScreen.Show

End Sub

[Brief explanation - this Workbook_Open sub will run every time the Excel workbook opens. Your user form name .Show just displays the user form, which will then trigger the Initialize sub that we set up in step 2.]

Make sure to save as a Macro-Enabled Workbook (xls or xlsm) and YOU’RE DONE!

Every time it’s opened, you’re splash screen should display for the amount of time you set. Let me know if you have any questions and good luck!

Share
  1. Backlink Software
    October 12th, 2010 at 06:32 | #1

    Hey admin, I have a simple request. I was just googleing for some information on this topic and found this post. Some really great stuff you shared here, can I please link to this post on my new website I’m working on? It would be great:) I will check back again later to see what you answered. Thank you, David Miller .

    • admin
      October 12th, 2010 at 06:47 | #2

      Sure.

  1. No trackbacks yet.