Microsoft Office Tutorials and References
In Depth Information
Creating a Splash Screen
h For best results, avoid using a RefEdit control inside of a Frame or a MultiPage
control. Doing so may cause Excel to crash.
h Don’t assume that RefEdit will always return a valid range address. Pointing to a range
isn’t the only way to get text into this control. The user can type any text and can also
edit or delete the displayed text. Therefore, you need to make sure that the range is valid.
The following code is an example of a way to check for a valid range. If an invalid range is
detected, the user is given a message, and focus is set to the RefEdit control so that
the user can try again.
On Error Resume Next
Set UserRange = Range(RefEdit1.Text)
If Err.Number <> 0 Then
MsgBox “Invalid range selected”
Exit Sub
End If
On Error GoTo 0
h The user can also click the worksheet tabs while selecting a range with the RefEdit
control. Therefore, you can’t assume that the selection is on the active sheet. However, if a
different sheet is selected, the range address is preceded by a sheet name. For example:
h If you need to get a single cell selection from the user, you can pick out the upper-left cell
of a selected range by using a statement such as
Set OneCell = Range(RefEdit1.Text).Range(“A1”)
As I discuss in Chapter 12, you can also use Excel’s InputBox method to allow the user
to select a range.
Creating a Splash Screen
Some developers like to display some introductory information when the application is opened.
This display is commonly known as a splash screen. You’re undoubtedly familiar with Excel’s
splash screen, which appears for a few seconds when Excel is loading.
You can create a splash screen for your Excel application with a UserForm. This example is
essentially a UserForm that displays automatically and then dismisses itself after five seconds.
The companion CD-ROM contains a workbook that demonstrates this procedure. The
file is named splash screen.xlsm .
Search JabSto ::

Custom Search