Sub SetLayerOff()
Dim LayerName As String
LayerName = "1"
On Error Resume Next
Err.Number = 0
Dim MyLayer As AcadLayer
Set MyLayer = ThisDrawing.Layers(LayerName)
If Err.Number = 0 Then
ThisDrawing.Layers(LayerName).LayerOn = False
ThisDrawing.Utility.Prompt vbCrLf & " 图层“" & LayerName & "”已经被关闭。"
Else
ThisDrawing.Utility.Prompt vbCrLf & " 图层“" & LayerName & "”不存在。"
End If
End Sub