image: userform
Enter te wording on a UserForm

Hands on: Making a splash in Excel

It’s easier than you think to create a polished-looking application with Excel

Written by Stephen Wells

If you have created an interesting Excel workbook you share with others ­ what software developers call an ‘application’ ­ then it deserves a title or splash screen that appears for a few seconds when the file is opened. You can make it happen with a few short macros.

Press Alt & F11 to open the VBA for Excel editor. On the Insert menu, choose UserForm. With the mouse, drag the bottom right-hand corner out to increase the blank form.

This is so that your title page will appear at a good size when superimposed over the first worksheet of your application.

Drag the displayed toolbox into a convenient position. Click the large capital A in the toolbox to select the Label control. Drag out a Label box on the UserForm. Delete the text, Label 1 and type your main title in this label.

If the Label 1 Properties window isn’t showing, press F4. Now you have a wide variety of options for creating a design. The default Font is probably Tahoma. Click on that and a Font dialogue box appears.
The example here uses Arial Black, Regular, 72 point. Go to TextAlign and choose, Center. Go to ForeColor, ButtonText, Palette, and choose a colour.

You can’t specify two different fonts within one label, so for the next line click on the cap A in the toolbox again and draw a second label. The Properties list will now be headed Label 2, so off you go again and type in the second line of your title page and format it differently but using the same procedures. If you have a third line, as in the finished example shown, create and format Label 3.

To colour in the background, click outside the labels but inside the UserForm and choose BackColor, Palette from the Properties list. For continuity, match this BackColor for each of the three labels.

One last thing. At the moment the top of your page says, UserForm 1. You really don’t want that appearing on your title page. Something more appropriate would be better.

At the top of the Properties list, change Name from UserForm 1 to Intro. Further down, also change Caption to Intro.

That’s the design created. Now all you have to do is make arrangements for it to appear. Double-click on the UserForm and in the Intro Code window click on the down arrow at the top right. Select Initialize. Complete the resulting code listing so it reads:

Private Sub UserForm_Initialize()
Application.OnTime Now + TimeValue(“00:00:04”), “ClearForm”
End Sub

This macro controls the amount of time the title page appears. In this example it’s for four seconds. You don’t want it to appear for much longer than it takes to read or the user will wonder what they are supposed to do next. On the VBA Insert menu select, Module and enter this code:

Sub ClearForm()
Unload Intro
End Sub

This establishes ClearForm as the macro to run after four seconds. Intro is the new Name for the default UserForm 1.

Finally, in the Project Explorer select ThisWorkbook. If the Project Explorer isn’t showing, press Ctrl & R. Enter:

Private Sub Workbook_Open()
Intro.Show
End Sub

Press Alt & F11 to return to your Excel workbook. Save the file. In the case of Excel 2007, save it as an .xlsm file, which will allow macros to be run. Close the workbook. If you have followed all the above instructions, the next time you open the file the title page will briefly appear.

Tags:

reader comments

related articles

 

related whitepapers

today's top stories

Learning from the credit crunch to avoid a broadband crunch

While it might be the most pressing issue de jour , the financial system isn’t the only area where government needs to... 10 Oct 2008

How careerism can warp IT procurement

Many working in IT put their career interests before those of their employer when weighing up purchasing options 10 Oct 2008

City in pressing need of skilled IT matchmakers

With the financial services sector plunging ever deeper into an M&A maelstrom, IT leaders are having their systems integration skills and due diligence expertise tested as never before 09 Oct 2008

The definitive guide to software development

Five key trends and five best practice tips to help you improve your programming capabilities 09 Oct 2008

Computing podcast - IT implications of the banking crisis, and the FSA clamps down on IT security

We discuss the effect of shotgun mergers and acquisitions on financial services IT staff, and examine the industry regulator's plan to fine directors for information security breaches 09 Oct 2008

Advertisement

Newsletter signup

Sign up for our range of FREE newsletters:

Existing User

Newsletter user login:

Jobs

Related jobs

Job of the week

Job alerts

Sign up here

Find your next job


IT Salary Checker

Check salary here

Advertisement

White papers

Search white papers

Top categories

VPN, Extranet and Intranet Solutions

WAN/ LAN Solutions

Network Security

Interoperability-Connectivity

Grid/ Utility Computing

Latest poll

Would you apply for a job that was advertised on Facebook or a similar social networking site?

Would you apply for a job that was advertised on Facebook or a similar social networking site?

The government is using Facebook to recruit IT staff - would you apply to such an ad?

Previous poll results

Latest audio and video articles

programming codeVideo

The definitive guide to software development

Five key trends and five best practice tips to help you improve your programming capabilities 09 Oct 2008

Podcast imageAudio

Computing podcast - IT implications of the banking crisis, and the FSA clamps down on IT security

We discuss the effect of shotgun mergers and acquisitions on financial services IT staff, and examine the industry regulator's plan to fine directors for information security breaches 09 Oct 2008

Latest in-depth articles

Financial Services Authority buildingAnalysis

FSA threatens executives with fines

Senior management to be held accountable for security lapses at banks 09 Oct 2008

Comment

Broadband must be a spending priority

For the economic health of the nation, the government would do better to bankroll an optical fibre rollout rather than prop up profligate banks 09 Oct 2008

Advertisement

Primary Navigation