Microsoft Office Tutorials and References
In Depth Information
Try It
Try iT
In this lesson you build a UserForm to browse the Internet.
lesson requirements
For this lesson, you design a UserForm to have the basic functionality of a web browser, including
the ability to navigate to the websites of your choice, go backward and forward to websites, and set
the initial website when the UserForm is initialized. To get the sample database files you can
download Lesson 20 from the book’s website at www.wrox.com .
step-by-step
1.
Open a new workbook and press Alt+F11 to get into the Visual Basic Editor.
2.
If the Project Explorer window is not visible, press Ctrl+R, and if the Properties window is
not visible, press the F4 key.
3.
In the Project Explorer window, select your workbook name, and from the menu bar click
Insert UserForm.
4.
In the Properties window for that UserForm, accept the default Name property of UserForm1,
set the Height property to 540 and the Width property to 852 .
5.
Click the Toolbox icon, or from the menu bar click View Toolbox.
6.
Draw a TextBox near the upper-left corner of the UserForm. Accept the default Name
property of TextBox1, set its Height property to , and its 24 Width property to 252 .
7.
Draw four CommandButtons along the top of the UserForm to the right of the TextBox.
Each CommandButton should be the same size, with its Height property set at and its 24
Width property set at 120 .
8.
Name the first CommandButton cmdNavigate and label its Caption property as Navigate . Set
its Default property to True.
9.
Name the second CommandButton cmdBack and label its Caption property as Back .
10.
Name the third CommandButton cmdForward and label its
Caption property as Forward .
11.
Name the fourth CommandButton cmdExit and label its
Caption property as Exit .
12.
The final control you’ll place onto your UserForm is a
WebBrowser, and chances are its icon is not on your
Toolbox’s Cover tab. If that’s the case, right-click the Cover
tab and select Additional Controls as shown in Figure 20-8.
figurE 20-8
Search JabSto ::




Custom Search