Microsoft Office Tutorials and References
In Depth Information
A Puzzle on a UserForm
Installing the Enhanced Data Form add-in
To try out the Enhanced Data Form, install the add-in:
1.
Copy the dataform3.xlam file from the CD-ROM to a directory on your hard drive.
2.
In Excel, press Alt+TI to display the Add-Ins dialog box.
3.
In the Add-Ins dialog box, click Browse and locate the dataform3.xlam file in the
directory from Step 1.
After performing these steps, you can access the Enhanced Data Form by using Data➜
DataForm➜J-Walk Enhanced DataForm. You can use the Enhanced Data Form to work with any
worksheet list or table.
A Puzzle on a UserForm
The example in this section is a familiar sliding puzzle, displayed on a UserForm (see Figure
15-30). This puzzle was invented by Noyes Chapman in the late 1800s. In addition to providing a
few minutes of amusement, you may find the coding instructive.
Figure 15-30: A sliding tile puzzle in a UserForm.
The goal is to arrange the shuffled tiles ( CommandButton controls) in numerical order. Click a
button next to the empty space, and the button moves to the empty space. The ComboBox
control lets the user choose from three configurations: 3 x 3, 4 x 4, and 5 x 5. The New button
shuffles the tiles, and a Label control keeps track of the number of moves.
This application uses a class module to handle all the button events (see “Handling Multiple
UserForm Controls with One Event Handler,” earlier in this chapter).
 
Search JabSto ::




Custom Search