Attribute VB_Name = "LayerGenerate" Option Explicit Public Sub CreateLayers() 'Create some Variables as needed 'An AEC Document to get at the AEC specific properties and functions Dim o_doc As AecArchBaseDocument 'An AEC databasepreferences to get at the AEC specific properties and functions Dim o_dbPref As AecArchBaseDatabasePreferences 'An AEC KeyStyles Collection, AEC KeyStyle, LayerKeys Collection, and LayerKey Dim o_cLayerKeyStyles As AecLayerKeyStyles Dim o_layerKeyStyle As AecLayerKeyStyle Dim o_cLayerKeys As AecLayerKeys Dim o_layerKey As AecLayerKey 'A typical layer object Dim o_layer As AcadLayer 'Activate the AEC Document using the AecArchBaseApplication Set o_doc = AecArchBaseApplication.ActiveDocument 'Activate the AEC Preferences Collection Set o_dbPref = o_doc.Preferences 'Activate the LayerKeyStyles collection Set o_cLayerKeyStyles = o_doc.LayerKeyStyles ' Sets the layer key style to the current layer standard Set o_layerKeyStyle = o_cLayerKeyStyles.Item(o_dbPref.LayerStandard) 'Activate the Keys collection of the current layer standard Set o_cLayerKeys = o_layerKeyStyle.Keys 'Cycle through each key in the style generating each layer For Each o_layerKey In o_cLayerKeys Set o_layer = o_layerKeyStyle.GenerateLayer(o_layerKey.Name) Next o_layerKey 'Clean up all your declared objects Set o_layer = Nothing Set o_cLayerKeys = Nothing Set o_layerKeyStyle = Nothing Set o_cLayerKeyStyles = Nothing Set o_dbPref = Nothing Set o_doc = Nothing End Sub