Using a UserForm for a Splash Screen

  • 13 years ago
    I have tried to implement a "Splash Screen" at the start of an Excel project, following the suggestion on pages 447 -449 of John Walkenbach's "Excel 2003 Power Programming with VBA".

    This puts   "Private Sub Workbook_Open()
                           UserForm1.Show
                      End Sub"
    into the "ThisWorkbook" code,

    and           "Private Sub UserForm1_Activate()
                           Application.OnTime  Now + TimeValue("00:00:05"), "KillTheForm"
                      End Sub"
    into the code for UserForm1

    Another subroutine is placed in any other module in the project:
                   "Private Sub KillTheForm()
                           Unload UserForm1
                          UserForm2.Show
                     End Sub"

    However this doesn't work.
    I have fallen back to the simple method of adding a ControlButton to unload UserForm1 and show the next UserForm.  This does work OK.

    I would still like the Splash Screen (UserForm1) to disappear after 5 seconds by itself, so how do I do It please ?






















  • 13 years ago

    Private Sub Workbook_Open()


        UserForm1.Show vbModeless
        Application.Wait (Now + TimeValue("0:00:05"))
        Unload UserForm1


    End Sub

    the vbModeless allows code to continue executing.

    Waits 5 seconds and unloads it.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Brevity is the soul of wit” - Shakespeare