1. Load the Wordfind.xls project and open the IDE. Find the PlaceWordO sub procedure and set a breakpoint on the statement If Not SelectionValid(wordDirection) Then. Return to Excel and run the program by clicking the Clear All button. Do not click refresh! Next, select a cell in the puzzle grid and click on an arrow button. When the debugger is invoked follow the order of program execution to see which statement generates the runtime error and triggers the code in the error handler.
2. Load the Wordfind.xls project and open the IDE. Set a break point to the statement that starts the For/Each loop in the GetWords() sub procedure listed in the code module for the Wordfind worksheet. Inside the For/Each loop, add a Debug.Print statement that outputs the value of the iterative cell to the Immediate window. Run the program to initiate debug mode and step through the program code while viewing the content of the Immediate window.
3. Clear the content of the Wordfind worksheet by clicking the Clear All button. Proceed to the IDE and replace the Debug.Print statement in Challenge 2 with the Debug.Assertstatement: Debug.Assert c.Value = cmbTopics.Value. Next, proceed to the Wordfind worksheet and click the Refresh button. After the program enters debug mode view the worksheet again to see if the content of the ActiveX controls has changed.
4. Write two VBA programs that save the content of the first 10 rows and columns in a worksheet to a tab-delimited text file. First use the SaveAs() method of the Worksheet object, then try using the Open statement to create a sequential access file. Be sure to include an error handler in the procedure that writes the data to the file.
5. Write two VBA programs that read the content of the text file created in Challenge 4. Use the Open() method of the Workbooks collection object and the Open statement.
6. Write a VBA program that saves the content of the first 3 rows and columns in a worksheet to a random access file. Write another program that reads the file into a worksheet.
7. Write a VBA program containing a UserForm with an Image control and a Command Button control such that the click of the Command Button control allows the user to select an image for loading into the Image control.
8. Edit the form module's code and/or design in the Word Find program to prevent the user from adding identical records to the data file.
9. Edit the form module's code in the Word Find program to allow the user to update existing topics in the data file.
10. Edit the form module's code in the Word Find program to allow users to delete selected records from the data file.
11. Edit the error handler in the GetAllRecords() sub procedure of the form module in the Word Find program such that it creates a new data file when a runtime error occurs. Be sure to fix any errors in other procedures that may result from the creation of an empty data file.
12. Enhance the Word Find program to include validation procedures that prevent the user from overwriting words previously added to a puzzle.
13. Enhance the Word Find program to include the ability to save and reload puzzles. Do not save the entire worksheet; instead, save the content of the puzzle and word list to a text file (give the file a custom extension such as .puz). Then write a procedure to read the text file into the Wordfind worksheet. Be sure to include a FileDialog object to allow the user to select a saved puzzle.
14. Enhance the Word Find program to include the ability to automatically generate puzzles based on the user's selection of a topic. The program should randomly select twenty-four words (or as many words that are in the list for that topic) from the list and add them to the puzzle without overwriting each other. Alternatively, the program can add just those words selected by the user from the List Box control. Be sure to change the MultiSelect property of the List Box control to allow for multiple selections.
Was this article helpful?
Discover the 100 Legal Secrets Las Vegas Professional Blackjack Gamblers Use to Make Literally Thousands of Dollars Every Week... I'll Teach You the Ultimate Step-by-Step Blackjack System, Casino's Don't Want You to Know About! That's Right, I'll show you step-by-step how to have the blackjack odds in your favor, guaranteed!