Function DelAllInLayer(ByVal LName As String) 'On Error Resume Next Dim SSet As AcadSelectionSet Set SSet = CreateSelectionSet("XXX") Dim Ft(0) As Integer, Fd(0) Ft(0) = 8: Fd(0) = LName SSet.Select acSelectionSetAll, , , Ft, Fd Dim E As AcadEntity 'MsgBox SSet.Count For Each E In SSet E.delete Next End Function Function CreateSelectionSet(Optional SSetName As String = "mjtd") As AcadSelectionSet On Error Resume Next ThisDrawing.SelectionSets(SSetName).delete Set CreateSelectionSet = ThisDrawing.SelectionSets.Add(SSetName) End Function 网上找到的,不知道怎么用。