Splash Screen

A splash screen is that thing that appears when you start a program. It’s designed to distract you from how long it takes to load the program. It’s also used for a little advertising or to nag you to register the software.

Here’s a simple way to create a splash screen for your program (written in Excel 2000 or higher). First create a userform

Splash2

Then set the ShowModal property to False to show the form modelessly. When you show a form modeless, the code that shows it continues to execute while the form is showing.

Splash1

Finally, code your program’s initialization procedure. There’s code in this example that shows the form for at least five seconds in case the initialization procedure runs to quick. If you go through the trouble of showing a splash screen, you’ll want to make sure that it’s visible long enough for the user to see it. If you have a lot of initialization stuff, you may be able to ignore that part altogether.

Sub StartProgram()

    Dim dtDelay As Date
    
    dtDelay = Now
    
    ufSplash.Show
    
    ‘Do initialization stuff
    
    If Now < (dtDelay + TimeSerial(0, 0, 5)) Then
        Application.Wait dtDelay + TimeSerial(0, 0, 5)
    End If
    
    Unload ufSplash
    
End Sub

Posted in Uncategorized

7 thoughts on “Splash Screen

  1. Well this doesn’t work. Now what?

    do you have to add Load.frmSplash before frmSplash.Show?

    I have tried different things and no go.

  2. Ross: Great article. I think I disagree with the one reason for splash screen. What about showmanship? You’ve got to keep bugging the users to get updates, register the product, and reminding them who wrote this great program they use everyday. Nevertheless, I think that article makes some excellent points.

    Am I right to assume that’s your website? What’s the schedule for more content? Let me know when you want a plug and you got it. I love the concept on the home page.

  3. Charlie: The first rule of asking Excel questions is “Be Specific” What doesn’t work? Make sure you have a userform named ufSplash. Then Tools>Macros>Macros and run StartProgram. Drop me an email if you want me to send my example workbook.

  4. Well, thanks a lot dick, yes it is.
    How did I over look that! Idea for blog post – adding music to your splash screen, might as well go the whole hog!

    I need to spend some (a lot) time on it, need to come up with ideas, that:

    a) are well thought out, valid and accurate
    b) worth while and that are sort of as “generic” as possible
    c) not done in lots of other places
    d) spell checked!!!!

    I think something about controls might be on the cards

  5. Also, I what to get other folks to do bits, so it not just me, 2 heads and that! – i will let you know about the plug! Thanks.

  6. I would like to get rid of the stupid title bar, but I can’t find the right properties to set. Any ideas…?


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.