Snakes in Excel, Lets Play!



The biggest downside to working in massive corporate offices is the locked down computer systems. There is no internet access, no games, no fun! However, Excel is always installed and kicking. How awesome would it be if Excel had a couple of games in it?

Initially I planned to use Excel’s VBE to create the game in a UserForm, but later, I decided to use Excel’s Interface itself. Neatly stacked square cells could be used to make old school pixel based games. I chose to create that Game which reached millions through our beloved Nokia mobile phones: Snakes.

Snakes

I have added in a lot of comments in the code to help you understand how it works. Take a look at it and let me know what you think. I have used API calls to windows for animating the Snake; and API functions are known to crash Excel, if Excel is not ready when called. My code takes that into account, but it is safe to save and close your workbooks before playing. I developed this in a 64-bit version of Excel 2010. I did created a separate 32-bit version for the API calls, but I have not tested it out myself.


Download

For the 64Bit users

Download

For the 32Bit Users

Download


Download and Have Fun! Send it around!  I am sure many of your colleagues would like to squeeze in a game or two between drafting ridiculously long reports.

Categories: Excel FunTags: , , , , , , ,

11 comments

  1. Ejaz, Good one

    Like

  2. Thanks Sajjad bhai. Which version worked for you? The 64 or the 32?

    Like

  3. Bhai, brilliance!! Respect.

    Like

  4. Hi Harsh. Thanks for letting me know! Have fun at work!

    Like

  5. Hi, I’m really interested in that Excel games, can you update the link, plz ?

    Liked by 1 person

  6. Nice work! An idea for improvement: You don’t need to have separate 32-bit and 64-bit files. You can use the preprocessor variable VBA7 to check for 64-bit. See: http://stackoverflow.com/questions/5506912/how-should-i-make-my-vba-code-compatible-with-64-bit-windows

    Liked by 1 person

  7. Why the “Optional ByVal booDummy As Boolean = False”?

    Like

  8. Thank you for the link. I did look into this before, but I did not have a 32 bit office to test it out. I still don’t. Would you be interested in helping me test it?

    Like

  9. Yeah, I can do that. They have 32-bit Office at my work. If you send or upload the file I’ll check if it works.

    Like

  10. That is actually a long story I meant to write about.

    You may want to prevent users from running intermediate subs in your modules from the macro dialog box.

    One way to accomplish that is to declare it private. However that will prevent you from using the call statement to access subs in other modules.

    You may argue that the run statement can be used, but that is not very ideal for a lot of reasons.

    Adding an argument will ensure that your sub does not get listed in the macro dialogue box.

    Therefore adding an optional dummy boolean argument hides the macro from a user, but still lets you use the call statement.

    I have been using this technique since excel 2003. There is a good chance we don’t need this workaround any more, but I am not sure.

    Like

  11. Lovely. I will get in touch with you when I get around to doing it. Thank you.

    Like

If you liked it, let me know. If you didn't make sure you let me know!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: