![]() |
Creating hangman(word game) on MS Excel
can any one plz help me create hangman word game on MS Excel??? thanking you nauman -- nauman612 ------------------------------------------------------------------------ nauman612's Profile: http://www.excelforum.com/member.php...o&userid=29548 View this thread: http://www.excelforum.com/showthread...hreadid=492519 |
Creating hangman(word game) on MS Excel
There is an example of this on John Walkenbach's site:
http://j-walk.com/ss/excel/files/general.htm at the bottom of the file list. RBS "nauman612" wrote in message ... can any one plz help me create hangman word game on MS Excel??? thanking you nauman -- nauman612 ------------------------------------------------------------------------ nauman612's Profile: http://www.excelforum.com/member.php...o&userid=29548 View this thread: http://www.excelforum.com/showthread...hreadid=492519 |
Creating hangman(word game) on MS Excel
Hi Nauman6,
See John Walkenbach's PUP addin: http://j-walk.com/ss/pup/pup6/features.htm --- Regards, Norman "nauman612" wrote in message ... can any one plz help me create hangman word game on MS Excel??? thanking you nauman -- nauman612 ------------------------------------------------------------------------ nauman612's Profile: http://www.excelforum.com/member.php...o&userid=29548 View this thread: http://www.excelforum.com/showthread...hreadid=492519 |
Creating hangman(word game) on MS Excel
go to: http://www.j-walk.com/ss/excel/files/general.ht -- Myle ----------------------------------------------------------------------- Myles's Profile: http://www.excelforum.com/member.php...fo&userid=2874 View this thread: http://www.excelforum.com/showthread.php?threadid=49251 |
Creating hangman(word game) on MS Excel
nauman612 wrote: can any one plz help me create hangman word game on MS Excel??? thanking you nauman -- nauman612 ------------------------------------------------------------------------ nauman612's Profile: http://www.excelforum.com/member.php...o&userid=29548 View this thread: http://www.excelforum.com/showthread...hreadid=492519 If all you want is a working copy of Hangman to run in Excel, then by all means go to Walkenbach's site. It you want to make your own program (I certainly would - the only way to learn anything is to reinvent lots of wheels), here are a few suggestions: 1) Learn VBA (a silly suggestion, but your post does not indicate how much VBA you know. A hangman program isn't all that hard, but it isn't trivial either, so isn't a good first program. *If* you are beginner in VBA I would recommend shelving the idea until you have plowed through a book.) This suggestion is relevant if the following suggestions seem completely obscure. 2) The main sheet (that the user would see) could be formatted so that every other column has a narrow width. You would need to write a macro to do this. Turn off gridlines and row/column labels at the end. The cells which are to hold the word could be underlined. The point of the narrow columns is to introduce spaces between the underlined cells. Your main hangman program would need to start by initializing the main sheet - clearing any previous data and underlining the right number of cells to indicate how many letters the user needs to guess. 3) Draw the gallows and completely hanged main on the main sheet. Change the name of each shape that you want to appear to (say) "hangman1", "hangman2", etc, with the numbers indicating the order you want them to appear. Change the visibility of each of these shapes to false. Then, your main program might have something like this: If CorrectGuess = False Then NumWrong = NumWrong + 1 Sheets(1).Shapes("hangman" & NumWrong).Visible = True If NumWrong MaxNumWrong Then MsgBox "Sorry, you lose!" Done = True End If End If 4) Store the actual words say in Column A of a sheet called "words", with maybe the number of words stored in B1. For testing purposes you could just write a couple of dozen. Afterwards, you could look into writing a macro that would take a text file consisting of thousands of words (say a listing of the 1000 most common words in English - surely google can find such a thing) and write them into the worksheet. If you are lucky, you may not even need to write a macro if Excel itself can import the data. The your main code would have something like NumWords = Sheets("words").Range("B1").Value i = Int(NumWords * Rnd()) Word = Range(Sheets("words").Range("A1").Offset(i).Value 5) The main loop (maybe a Do Until Done loop) could consist of using an inputbox to ask the user for a guess. Using InStr() to check if the guessed letter occurs in the word then acting accordingly: if a correct guess then making that letter visible and incrementing a variable CorrectGuesses and comparing it to the length of the word to see if they have won; if a wrong guess then displaying the incorrect guess in the spreadsheet and making another shape visible (see above). Hope that helps. If you decide to go that route, don't hesitate to ask more questions if you get stuck at specific things (like how do you change the name of a shape or use InStr()). -John Coleman |
Creating hangman(word game) on MS Excel
Hi John,
If all you want is a working copy of Hangman to run in Excel, then by all means go to Walkenbach's site John Walkenbach's download also provides access to highly instructive code. the only way to learn anything is to reinvent lots of wheels This statement may represent your view, but strikes me as rather too sweeping in ambit. Regards, Norman "John Coleman" wrote in message ups.com... nauman612 wrote: can any one plz help me create hangman word game on MS Excel??? thanking you nauman -- nauman612 ------------------------------------------------------------------------ nauman612's Profile: http://www.excelforum.com/member.php...o&userid=29548 View this thread: http://www.excelforum.com/showthread...hreadid=492519 If all you want is a working copy of Hangman to run in Excel, then by all means go to Walkenbach's site. It you want to make your own program (I certainly would - the only way to learn anything is to reinvent lots of wheels), here are a few suggestions: 1) Learn VBA (a silly suggestion, but your post does not indicate how much VBA you know. A hangman program isn't all that hard, but it isn't trivial either, so isn't a good first program. *If* you are beginner in VBA I would recommend shelving the idea until you have plowed through a book.) This suggestion is relevant if the following suggestions seem completely obscure. 2) The main sheet (that the user would see) could be formatted so that every other column has a narrow width. You would need to write a macro to do this. Turn off gridlines and row/column labels at the end. The cells which are to hold the word could be underlined. The point of the narrow columns is to introduce spaces between the underlined cells. Your main hangman program would need to start by initializing the main sheet - clearing any previous data and underlining the right number of cells to indicate how many letters the user needs to guess. 3) Draw the gallows and completely hanged main on the main sheet. Change the name of each shape that you want to appear to (say) "hangman1", "hangman2", etc, with the numbers indicating the order you want them to appear. Change the visibility of each of these shapes to false. Then, your main program might have something like this: If CorrectGuess = False Then NumWrong = NumWrong + 1 Sheets(1).Shapes("hangman" & NumWrong).Visible = True If NumWrong MaxNumWrong Then MsgBox "Sorry, you lose!" Done = True End If End If 4) Store the actual words say in Column A of a sheet called "words", with maybe the number of words stored in B1. For testing purposes you could just write a couple of dozen. Afterwards, you could look into writing a macro that would take a text file consisting of thousands of words (say a listing of the 1000 most common words in English - surely google can find such a thing) and write them into the worksheet. If you are lucky, you may not even need to write a macro if Excel itself can import the data. The your main code would have something like NumWords = Sheets("words").Range("B1").Value i = Int(NumWords * Rnd()) Word = Range(Sheets("words").Range("A1").Offset(i).Value 5) The main loop (maybe a Do Until Done loop) could consist of using an inputbox to ask the user for a guess. Using InStr() to check if the guessed letter occurs in the word then acting accordingly: if a correct guess then making that letter visible and incrementing a variable CorrectGuesses and comparing it to the length of the word to see if they have won; if a wrong guess then displaying the incorrect guess in the spreadsheet and making another shape visible (see above). Hope that helps. If you decide to go that route, don't hesitate to ask more questions if you get stuck at specific things (like how do you change the name of a shape or use InStr()). -John Coleman |
Creating hangman(word game) on MS Excel
Norman Jones wrote: Hi John, If all you want is a working copy of Hangman to run in Excel, then by all means go to Walkenbach's site John Walkenbach's download also provides access to highly instructive code. the only way to learn anything is to reinvent lots of wheels This statement may represent your view, but strikes me as rather too sweeping in ambit. I didn't say all wheels - just lots of wheels. Hangman in particular strikes me as a perfect learning opportunity: moderately challenging without being discouragingly hard and you get something *cool* for your effort. -John |
Creating hangman(word game) on MS Excel
Norman Jones wrote: (snip) John Walkenbach's download also provides access to highly instructive code. (snip) I definitely concur with that. Much of what I know about VBA I learned from his books, and have found his website useful and entertaining as well. -John Coleman |
Creating hangman(word game) on MS Excel
While on the subject of games and the Hangman, one of the surest way of exercising your programming muscle (in EXCEL) is to turn your hand to developing games - word games are a good starting point - and it is best to hatch your own original design. I have particularly learnt a great deal manipulating userforms in this fashion. The challenges that are confronted make good study fare and the spin-offs into mainstream applications are enormous. So within the confines, if limited, of Excel's functionality for games there is a healthy potential to fast-track the mastery of VBA - to a certain degree. Myles. -- Myles ------------------------------------------------------------------------ Myles's Profile: http://www.excelforum.com/member.php...o&userid=28746 View this thread: http://www.excelforum.com/showthread...hreadid=492519 |
All times are GMT +1. The time now is 12:14 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com