下面这段代码是我在论坛里面挖出来的,正是我需要的,但是这段代码没有给出声明部分的内容(主要是colLayers这个变量,应该是dim colLayers as ????),麻烦知道的大牛们帮忙补充一下,谢谢了~
' 获得图层数量
Set colLayers = ThisDrawing.Layers
ReDim aryLayerNames(colLayers.Count - 1)
'获得图层名称
For intLayerCnt = 0 To colLayers.Count - 1
aryLayerNames(intLayerCnt) = colLayers.Item(intLayerCnt).Name
'获得当前图层名称
If ThisDrawing.ActiveLayer.Name = aryLayerNames(intLayerCnt) Then
touchen = aryLayerNames(intLayerCnt)
End If
Next
'向组合框中添加图层名称
For intLayerCnt = LBound(aryLayerNames) To UBound(aryLayerNames)
ComboBox1.AddItem aryLayerNames(intLayerCnt)
Next