Microsoft Office Tutorials and References
In Depth Information
Video Poker on a UserForm
The VBA code is rather lengthy, so it’s not listed here. Here are a few points to keep in mind
when examining the code:
h The CommandButton controls are added to the UserForm via code. The number and
size of the buttons are determined by the ComboBox value.
h The tiles are shuffled by simulating a few thousand random clicks on the buttons.
Another option is to simply assign random numbers, but that could result in some
unsolvable games.
h The blank space is actually a CommandButton with its Visible property set to False .
h The class module contains one event procedure ( MouseUp ), which is executed whenever
the user clicks a tile.
h When the user clicks a CommandButton tile, its Caption is swapped with the hidden
button. The code doesn’t actually move any buttons.
This workbook, named sliding tile puzzle.xlsm , is available on the companion
CD-ROM.
Video Poker on a UserForm
And finally, proof that Excel doesn’t have to be boring. Figure 15-31 shows a UserForm set up as a
casino-style video poker game. The game features
h A choice between two games: Joker’s Wild and Jacks Or Better
h A chart that shows your winning (or losing) history
h The ability to change the payoffs
h Help (displayed on a worksheet)
h An emergency button that quickly hides the UserForm
All that’s missing is the casino noise.
This workbook, named video poker.xlsm , is available on the companion CD-ROM.
 
Search JabSto ::




Custom Search