You are on page 1of 4

Sample Visual Basic® Code for Controlling UserForms

To display the sample UserForms included with this file, click the button shown below.

To view the Visual Basic for Applications code behind the UserForms, you must start the
Visual Basic Editor. To start the Visual Basic Editor, point to Macro on the Tools menu, and
then click Visual Basic Editor.

After you start the Visual Basic Editor, display the Project Explorer and Properties windows.
To display the Properties window, click Properties Window on the View menu. To display the
Project Explorer window, click Project Explorer on the View menu.

To view the Visual Basic code behind a particular UserForm, double-click the UserForm in
the Project Explorer window. This displays the UserForm. Then, double-click the body of the
UserForm to open the Code window for that UserForm.
100
January Monday Tuesday Wenesday Thursday Friday
February
March
April
May
June
July Year Region Sales
August 1996 North 140
September 1996 South 210
October 1996 MidWest 190
November 1996 NorthWest 230
December 1997 South 165
Sena 1997 MidWest 134
Control Description Name of UserForm
CheckBox Getting the Current Value frmCheckBoxExample
ComboBox Adding new data frmComboBoxExample1
ComboBox Automatically displaying the list frmComboBoxExample2
Frame Looping Through Controls frmFrameExample
Image Loading a Bitmap frmImageExample
Label Updating a Label frmLabelExample
ListBox Getting the Selected Item(s) frmListBoxExample1
ListBox Adding and Removing items frmListBoxExample2
ListBox Multi-Column Example frmListBoxExample3
MultiPage Creating a Wizard Interface frmMultiPageExample
OptionButton Getting the Selected OptionButton frmOptionButtonExample
RefEdit Using the RefEdit Control frmRefEditExample
ScrollBar Using the Value Property frmScrollBarExample
SpinButton Incrementing a Date frmSpinButtonExample
TabStrip Updating a Control Based on Active Tab frmTabStripExample
TextBox Validating a Password frmTextBoxExample
ToggleButton Using the Value Property frmToggleButtonExample1
ToggleButton Creating a Mutually Exclusive Group frmToggleButtonExample2
UserForm Utilizing Events frmUserFormEventExample1
UserForm Disabling the Close button frmUserFormEventExample2

You might also like