By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,493 Members | 1,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,493 IT Pros & Developers. It's quick & easy.

Need Help to Convert this Mapbasic's Mapinfo code into VBA

P: 14
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.

Expand|Select|Wrap|Line Numbers
  1. Global sTable, sLegendTitle, sLegendSubtitle as String
  2. Global aColumn as Alias
  3. Global iNumberOfRanges as Integer
  4.  
  5.     sTable = "MapTable"
  6.     aColumn = "Population"
  7.     iNumberOfRanges = 8
  8.     sLegendTitle = "Population"
  9.     sLegendSubtitle = "Recent Data"
  10.  
  11.  
  12. Sub CreateThematic
  13.  
  14. OnError Goto ErrorHandler
  15.  
  16. Dim fRangeLimitsArray() As Float
  17. Dim bBrushStylesArray() As Brush
  18.  
  19. 'create ranges on selected column
  20.     Create Ranges From sTable With aColumn Use "Equal Count" Number iNumberOfRanges Round 1 Into Variable fRangeLimitsArray
  21.  
  22. 'create styles for the specified number of ranges
  23.     Create Styles From Brush (2,15597520,16777215) To Brush (2,32768,16777215) Vary Color By "RGB" Number iNumberOfRanges Into Variable bBrushStylesArray 
  24.  
  25.     'apply thematic
  26.     Shade Window FrontWindow() sTable With aColumn Ranges From Variable fRangeLimitsArray Style Variable bBrushStylesArray        
  27.  
  28.     'show legend
  29.     Open Window Legend
  30.  
  31.     'modify legend
  32.     Set Legend Window FrontWindow() Layer 1 Count On Title sLegendTitle Font ("Arial",1,9,255) Subtitle sLegendSubtitle Font ("Arial",2,8,255)
  33.  
  34.     'change legend window size
  35.     Set Window Legend
  36.         Width 3.54167 Units "in" Height 3.54167 Units "in"
  37.  
  38. Exit Sub
  39.  
  40. ErrorHandler:
  41.     Note Error$()
  42.  
  43. End Sub CreateThematic
  44.  
Sep 14 '12 #1
Share this Question
Share on Google+
1 Reply


MMcCarthy
Expert Mod 10K+
P: 14,534
It is unlikely anyone here can help you unless they have mabbasic knowledge. You need to find someone who knows mabbasic who can translate this code for you so you know what it is doing exactly. Then our members can help we creating a similar function in VBA.
Sep 14 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.