Excel: How to Use a Custom Dialog Box as a Startup Screen

Last reviewed: September 2, 1997
Article ID: Q136222
The information in this article applies to:
  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Excel for Windows NT, version 5.0
  • Microsoft Excel for Windows 95, version 7.0

SUMMARY

In Microsoft Excel, it is possible to use a custom dialog box and a Visual Basic, Applications Edition, procedure together to create a startup (or "splash") screen.

MORE INFORMATION

A splash screen is a dialog box that is shown on the screen for a specified amount of time. When the specified amount of time has elapsed, the dialog box is hidden without any user interaction.

Visual Basic Code Example

Microsoft provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose.

The following Visual Basic code will show a custom dialog box and hide the dialog box after 5 seconds have elapsed. If you want the dialog box to be displayed for more than 5 seconds, change the time that is specified in the macro.

This example assumes that you have created a custom dialog box named "Dialog1."

To run the example, position the insertion point in the "Sub ShowDialog()" line and press F5.

'------------------------------------------------
Sub ShowDialog()
   DialogSheets("Dialog1").Show
End Sub

'Attach this to the frame of the dialog box.
Sub OnShow()
   Application.SendKeys "~"
   MsgBox "This will not be displayed."
   Application.Wait Now + TimeValue("00:00:05")
   DialogSheets("Dialog1").Hide
End Sub
'------------------------------------------------

NOTE: To attach a macro to the frame of a dialog box, follow one of the procedures below.
  • Click once on the dialog box so that the frame of the dialog is selected. You will know that it is selected when you see the handles displayed around the edges of the dialog box. Once the dialog box is selected, choose Assign Macro from the Tools menu. From the list of macros, choose the macro to be assigned to the frame of the dialog and click OK.

    -or-

  • With the right mouse button, click the frame of the dialog box. On the shortcut menu, click Assign Macro. From the list of macros, select the macro to be assigned to the frame of the dialog box and click OK.


Additional query words: 7.00 5.00 splash
Keywords : kbprg PgmHowTo kbcode kbprg
Version : 5.00 5.00c 7.00
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.