引用我的增强选择集类(在我的博客里找:)),运行下面的程序
Sub ttx() Dim ss As New TlsSelectSet ss.Init ss.Filter.SetData -4, "<or", 62, acRed For Each i In ThisDrawing.Layers If i.Color = acRed Then ss.Filter.AppendData -4, "<and", 8, i.Name, 62, acByLayer, -4, "and>" End If Next i ss.Filter.AppendData -4, "or>" ss.SelectObject acSelectionSetAll MsgBox ss.Count End Sub
或者
Sub ttx() Dim ss As New TlsSelectSet ss.Init For Each i In ThisDrawing.Layers If i.Color = acRed Then s = s & i.Name & "," End If Next i s = Left(s, Len(s) - 1) ss.Filter.SetData -4, "<or", 62, acRed, -4, "<and", 8, s, 62, acByLayer, -4, "and>", -4, "or>" ss.SelectObject acSelectionSetAll MsgBox ss.Count End Sub
|