Private Sub SelectLWPOLYLINE() Dim SSet As AcadSelectionSet Set SSet = CreateSelectionSet Dim fType(1) As Integer ' 过滤器规则 Dim fData(1) As Variant ' 过滤器参数 fType(0) = 0: fData(0) = "LWPOLYLINE": fType(1) = 8: fData(1) = "*" SSet.Select acSelectionSetAll, , , fType, fData MsgBox SSet.Count End Sub Public Function CreateSelectionSet(Optional ssName As String = "ss") As AcadSelectionSet '返回一个空白选择集
Dim ss As AcadSelectionSet
On Error Resume Next Set ss = ThisDrawing.SelectionSets(ssName) If Err Then Set ss = ThisDrawing.SelectionSets.Add(ssName) ss.Clear Set CreateSelectionSet = ss End Function 建议将fDate改为fData。