寻求这段代码需要声明的变量(dim colLayers as ???)
本帖最后由 cannywind 于 2012-8-11 15:04 编辑下面这段代码是我在论坛里面挖出来的,正是我需要的,但是这段代码没有给出声明部分的内容(主要是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
是数组,可以声明为variant,或者干脆省略as和类型
页:
[1]