561 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owls only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
|Wordle in Excel VBA|
|Have you played Wordle yet? You should, it's great! We're a bit obsessed with it at Wise Owl so Andrew, Andy and Sam have all been working their own versions of the game in VBA, Python and Power BI(!) respectively. Check out this quick intro to Andrew's VBA version.|
Not ones to pass up the opportunity for a bit of shameless bandwagon-jumping (remember Flappy Bird in Excel VBA, anyone?), the Wise Owls have been busy working on their own versions of the viral game, Wordle!
I made the VBA version as faithful as possible to the original, including accepting crazy US English spellings!
If you're as obsessed with Wordle as we are, be warned that this Excel VBA version uses the same daily words as the official version. I'll avoid spoilers in this blog but, if you don't want your daily Wordle fun to be ruined, you may want to avoid playing the VBA version until you've finished the official daily game.
I thought it would be fun! And it was! Mostly.
I think Wordle is excellent - it feels rewarding and it's beautiful in the simplicity of its presentation (it reminds me of Hexcells and Sokobond). As I'm not creative enough to come up with an idea like this myself, remaking it in Excel was the next best thing. Imitation is the sincerest form of flattery, after all!
Of course, we're hoping to ride the hype-train surrounding the original game at least a little bit! But, in the spirit of the original, we're not attempting to profit from this directly. There's some protection in the workbook but it's to prevent accidental changes. The only password you need is wordle. You can do anything you like with the file and the code: share it, modify it, learn from it, just don't sell it!
After you've downloaded and unzipped the file you can open it in Excel and you'll be ready to play! You'll need to enable macros when you first open the file, otherwise it won't be much fun.
When you open the file, click Enable Content to make sure you can actually play the game.
There's nothing intentionally dodgy about any of the code I've written. Unintentional dodginess is a distinct possibility however! If you don't want to risk it you can still open the file without enabling macros and then check out the code yourself to see how everything works (see below for how to do this).
Each day Wordle picks a secret, five-letter word. You have six attempts to guess the word. Each time you make a guess, Wordle tells you how close you are to the correct answer by colouring the letters you've used.
You can see a help page by clicking the ? button in the top left of the Wordle window.
You can enter letters into the grid by clicking cells in the keyboard at the bottom of the window:
Click a cell in the keyboard to enter the letter into the grid. Click the backspace button to remove the last letter. Click ENTER to submit your guess.
When you've submitted your guess, the letters will be coloured according to how close they are to the hidden word:
Green indicates that the letter O appears in the word in the same position. Yellow means that the letter D appears in the word in a different position. The letters W, R and S don't appear in the word at all. Cell styles would have been a good way to generate the different colours. It's a shame I didn't use cell styles.
Keep entering guesses until you either get it right or run out of attempts.
You can see the game options by clicking the gear icon in the top right of the window.
Click here to see options.
Click the toggle buttons to switch options on and off:
All of the options work except for the Dark Theme which I sadly didn't get chance to implement before running out of time. You can still enjoy toggling the button though.
Enabling Hard Mode means that you must use the clues you've been given in your next guess. You can't enable this option if you've already submitted a guess, but you can disable it at any point.
Enabling Colour Blind Mode alters the colours used to indicate correctly guessed letters:
Letters in the correct position will be orange; letters in the word but in the wrong position will be blue. A sensible person would have used cell styles to create these different colours.
If you consider seeing your success in the form of a basic bar chart a prize, then yes! Win or lose, the statistics panel will appear automatically at the end of the game:
The bar corresponding to today's score will be coloured. Today was not a good day.
You can close the statistics panel by clicking anywhere in the game window. To redisplay it, click the chart icon in the top right of the screen.
I'm aware that this is pedantic but shouldn't the image be a bar chart rather than a column chart?
What would be the point of Wordle if you couldn't brag about your most recent score to your friends/family/strangers in the street?
I have never bragged about my Wordle results.
You can click the Share button on the statistics panel to copy an image of your guessing pattern to the clipboard. The Share button will only appear if you've finished today's game.
In the official version, on an Android or iOS device you can share directly to various social media platforms. I've replicated the simpler approach used by web browsers running in Windows which just copies the results to the clipboard.
You can then paste your picture into another application. The images below show the result of pasting into an Outlook email:
|Colour Blind Mode On||Colour Blind Mode Off|
The ability to share your result without giving away the answer might be my favourite part of the original game's design.
You have only one chance to play each day's game. Wordle chooses a new word automatically at the beginning of the next day so, if you failed, you must bear the shame until then.
The statistics panel shows how long you have to wait for the next word.
Of course, there's nothing to stop you digging into the game's code to alter this...
You'll need to open the VB Editor first - press ALT + F11 to do this.
Click the + button next to the VBAProject in the Project Explorer window and enter the password. It's wordle but shhh, don't tell anyone.
Once you've unlocked the project you can open the Modules folder. Double-click any module to see the code inside.
The m_Dev module has a few useful basic procedures for testing.
At this point you can make any changes to the code that you like. Have fun!
Not quite. The game is driven by the SelectionChange event on the GameSheet worksheet.
Double-click the GameSheet object to see its code.
The SelectionChange event is triggered whenever you select a cell on the worksheet.
This event handling subroutine doesn't do much other than call the procedures which do all the work.
The main job of this subroutine is to call the CheckClickedCell procedure. If you want to see what this does, you can right-click the name of the procedure and choose to view its definition:
Right-click the procedure name and choose Definition. This takes you to the module which contains the CheckClickedCell subroutine.
You can keep following the chain of procedure calls like this to see how the game works, although it may take you some time!
Me too! There's so much that I'd change but there was a deadline and I needed to get the thing working. Briefly, here's what I don't like about what I've done:
Anyway, I'm pleased to get the majority of the game and its features working!
Yeah, I know, but I was aiming for as faithful a reproduction of the original as I could create in Excel. Out of interest though, if I had wanted to my make my life easier, I would have:
These are just some of the basic things that spring to mind - I'm sure you can find plenty of ways to improve it.
25 Aytoun Street