I have this code that I gather from MabBasic (MapInfo) which will create thematic map. I need help to convert this code into VBA, so I can programatically create thematic map within MS Access/VBA.
Code:
Global sTable, sLegendTitle, sLegendSubtitle as String
Global aColumn as Alias
Global iNumberOfRanges as Integer
sTable = "MapTable"
aColumn = "Population"
iNumberOfRanges = 8
sLegendTitle = "Population"
sLegendSubtitle = "Recent Data"
Sub CreateThematic
OnError Goto ErrorHandler
Dim fRangeLimitsArray() As Float
Dim bBrushStylesArray() As Brush
'create ranges on selected column
Create Ranges From sTable With aColumn Use "Equal Count" Number iNumberOfRanges Round 1 Into Variable fRangeLimitsArray
'create styles for the specified number of ranges
Create Styles From Brush (2,15597520,16777215) To Brush (2,32768,16777215) Vary Color By "RGB" Number iNumberOfRanges Into Variable bBrushStylesArray
'apply thematic
Shade Window FrontWindow() sTable With aColumn Ranges From Variable fRangeLimitsArray Style Variable bBrushStylesArray
'show legend
Open Window Legend
'modify legend
Set Legend Window FrontWindow() Layer 1 Count On Title sLegendTitle Font ("Arial",1,9,255) Subtitle sLegendSubtitle Font ("Arial",2,8,255)
'change legend window size
Set Window Legend
Width 3.54167 Units "in" Height 3.54167 Units "in"
Exit Sub
ErrorHandler:
Note Error$()
End Sub CreateThematic
Comment