Private Sub AcadDocument_ObjectModified(ByVal Object As Object)
Dim subBool As Boolean Dim subName_Obj As String On Error Resume Next subName_Obj = Object.ObjectName If Err <> 0 Then Err.Clear ElseIf subName_Obj = "AcDbLayerTableRecord" Then If Object.Name = "锁定图层" Then loclayer End If End If End Sub
Public Sub locklayer() On Error Resume Next
Dim layer As AcadLayer Set layer = thisdrawing.Layers("锁定图层") layer.TrueColor = c251 layer.LayerOn = True layer.Lock = True layer.Freeze = False
If Err <> 0 Then MsgBox Err.Description End If End Sub