Microsoft Office Tutorials and References
In Depth Information
Chapter 14: UserForm Examples
Figure 14-1: This dialog box uses CommandButtons as a menu.
Private Sub CommandButton1_Click()
This procedure hides the UserForm, calls Macro1 , and then closes the UserForm. The other
buttons have similar event-handler procedures.
Using a ListBox in a UserForm
Figure 14-2 shows another example that uses a ListBox as a menu. Before the UserForm is
displayed, its Initialize event-handler procedure is called. This procedure, which follows, uses
the AddItem method to add six items to the ListBox:
Figure 14-2: This dialog box uses a ListBox as a menu.
Private Sub UserForm_Initialize()