Using Command Buttons in a User Form

Figure 14-1 shows an example of a UserForm that uses CommandButton controls as a simple menu. Setting up this sort of thing is very easy, and the code behind the UserForm is very straightforward. Each CommandButton has its own event handler procedure. For example, the following procedure is executed when CommandButtonl is clicked:

Button Menu Demo

Execute Macro 1

Execute Macro 4

Execute Macro 2

Execute Macro 5

Execute Macro 3

Execute Macro 6

1 : Cancel | |

Figure 14-1: This dialog box uses CommandButtons as a menu.

Figure 14-1: This dialog box uses CommandButtons as a menu.

Private Sub CommandButton1_Click() Call Macrol Unload Me End Sub

This procedure simply calls Macrol and closes the UserForm. The other buttons have similar event handler procedures.

0 0

Post a comment