Sub test()
Dim ssetobj As AcadSelectionSet
Dim s As AcadSelectionSet这里有问题,要改成这样:Dim s As AcadEntity
On Error Resume Next
Set ssetobj = ThisDrawing.SelectionSets.Add("egua")
If Err Then
Err.Clear
Set ssetobj = ThisDrawing.SelectionSets.Item("egua")
End If
ssetobj.Clear
ssetobj.SelectOnScreen
For Each s In ssetobj
ThisDrawing.Layers.Item(s.Layer).LayerOn = False
Next s
End Sub