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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yus2aces
    New Member
    • Sep 2012
    • 14

    #1

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

    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
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    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.

    Comment

    Working...