How to enable drawing of unplaced labels


This sample demonstrates how to programmatically enable "Draw Unplaced Labels" for all the data frames in an MXD. This sample takes advantage of generic interfaces that work on both the ESRI Standard Label Engine and ESRI Maplex Label Engine, so the sample will work with or without Maplex.

How to use

  1. Copy and paste the sample code into the VBA Editor.
  2. Run the Macro.
[VBA]
Public Sub EnableDrawUnplacedLabels()
    
    Dim pMxDoc As IMxDocument
    Dim pMaps As IMaps
    Dim pMap As IMap
    Dim pMapOverposter As IMapOverposter
    Dim index As Long
    Dim pOverposterOptions As IOverposterOptions
    
    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
        
        Set pOverposterOptions = pMapOverposter.OverposterProperties
        pOverposterOptions.EnableDrawUnplaced = True
        
    Next index
    
End Sub