How to change Maplex label quality to best


This sample demonstrates how to change the Maplex Label Engine quality to "Best" for all data frames in a map document to Maplex programmatically. The data frame should already be using the Maplex Label Engine before running this sample.

How to use

  1. Copy and paste the sample code into the VBA Editor.
  2. Run the Macro.
[VBA]
Public Sub ChangeMaplexLabelQualityToBest()
    
    Dim pMxDoc As IMxDocument
    Dim pMaps As IMaps
    Dim pMap As IMap
    Dim pMapOverposter As IMapOverposter
    Dim index As Long
    Dim pMaplexOverposterProperties As IMaplexOverposterProperties
    
    Set pMxDoc = ThisDocument
    Set pMaps = pMxDoc.Maps
    
    'loop through all the maps
    For index = 0 To pMaps.Count - 1
        Set pMap = pMaps.Item(index) 'get the map at the current index
        Set pMapOverposter = pMap
        
        'see if the map we are dealing with has Maplex Overposter properties
        'If it does, get a reference to the properties and change the placement quality
        If TypeOf pMapOverposter.OverposterProperties Is IMaplexOverposterProperties Then
            Set pMaplexOverposterProperties = pMapOverposter.OverposterProperties
            pMaplexOverposterProperties.PlacementQuality = esriMaplexPlacementQualityHigh
        End If
        
    Next index
    
End Sub






Additional Requirements
  • The Data Frames should already be using the Maplex Label Engine