Microsoft Office Tutorials and References
In Depth Information
In this lesson you build a UserForm to browse the Internet.
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
Open a new workbook and press Alt+F11 to get into the Visual Basic Editor.
If the Project Explorer window is not visible, press Ctrl+R, and if the Properties window is
not visible, press the F4 key.
In the Project Explorer window, select your workbook name, and from the menu bar click
Insert ➪ UserForm.
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 .
Click the Toolbox icon, or from the menu bar click View ➪ Toolbox.
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 .
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 .
Name the first CommandButton cmdNavigate and label its Caption property as Navigate . Set
its Default property to True.
Name the second CommandButton cmdBack and label its Caption property as Back .
Name the third CommandButton cmdForward and label its
Caption property as Forward .
Name the fourth CommandButton cmdExit and label its
Caption property as Exit .
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.