Since the guide and release in late 2012, the State Identification Game have become one of the most popular downloads on MapForums.
The State Identification Game became advanced the usage of Excel VBA and MapPoint. The MapPoint version should be at least 2010 as it become in this version that you were first able to control map layers and turn off labels. Excel versions tested consist of 2007 and 2010, but I do not see a reason why it should now not paintings with in advance variations of Excel.
Since the launched of the compiled sport, several builders have requested, and I even have formerly shared the code privately, but now for the primary time in this newsletter, we’re now making the total source code for the sport to be had for public down load.
Launching the Game
The down load hyperlink with the sport uncompiled vist https://regary.com/gta-4-highly-compressed/ and with complete source code as an Excel macro-enabled (.Xlsm) record is at the bottom of this newsletter.
When opened, the macro at once kicks off the game via using the Workbook_Open approach of the ThisWorkbook object. This is set as proven within the screenshot under.
This is the preliminary code which opens (instantiates) MapPoint, units the toolbars, and triggers the form.
Public APP As Object
Public MAP As Object
Public Sub StateIdentifier()
Private Sub InstantiateMapPoint()
Set APP = CreateObject(“MapPoint.Application”)
APP.Visible = True
APP.WindowState = geoWindowStateMaximize
Set MAP = APP.ActiveMap
APP.PaneState = geoPaneNone
APP.ItineraryVisible = False
Dim tool As Object
‘in particular want to cover the Location and Scale toolbar or it essentially gives you the answer!
For Each tool In APP.Toolbars
tool.Visible = False
All of the remaining code and game logic are contained in the form item.
Opening The frmStateIdentifier UserForm
When first opened, the form publicizes numerous module-stage variables, turns off the MapPoint labels, and begins the game.
Private s(three) As Integer
Private i, Correct, Answer, Round As Integer
Private stateTXT As String
Private resultTXT As String
Private wks As Excel.Worksheet
Private Sub UserForm_Activate()
Set wks = Excel.ActiveWorkbook.Sheets(“US States”)
Application.WindowState = xlNormal
Application.Height = 50
Application.Width = 50
You can see that the code additionally shrinks the Excel Application so that it will maintain it out of the way. One of the primary demanding situations in the use of Excel and a separate instance of MapPoint, changed into to get Excel out of the manner, and allow the shape with the buttons flow over the map. This is completed with the WindowState, Height, and Width residences of the Application item.
The TurnOffAllLabels code became discussed inside the MapPoint Game Setup article.
Setting up the Rounds
The PlayGame subroutine sets the preliminary variables and calls SetupRound.