HOW TO

Open a layer's property pages using VBA in ArcMap

Last Published: April 25, 2020

Summary

This sample code displays a layer's property sheet using VBA. You can use Step 3 to show all the property pages for a layer, or Step 4 to show just a specific property page.

Procedure



  1. Get a reference to the first layer in the active map.

    'Get a pointer to the Focus Map
    Dim pDoc As IMxDocument
    Dim pMap As IMap
    Set pDoc = ThisDocument
    Set pMap = pDoc.FocusMap

    'Get a pointer to the first layer
    Dim pLayer As IFeatureLayer
    Set pLayer = pMap.Layer(0)

  2. Add the layer to a new set.

    Code:
    Dim pSheet As IComPropertySheet
    Set pSheet = New esriCore.ComPropertySheet
    Dim pPset As esriCore.ISet
    Set pPset = New esriCore.Set
    pPset.Add pLayer

  3. Display all the Property pages with the Symbology page active.

    Code:
    pSheet.ActivePage = 4
    pSheet.EditProperties pPset, 0


  4. Display the Symbology Property Page only.

    Code:
    Dim page As IPropertyPage
    Set page = New LayerDrawingPropertyPage
    pSheet.AddCategoryID New UID
    pSheet.AddPage page
    pSheet.EditProperties pPset, 0

Article ID:000002685

Software:
  • ArcMap 8 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic