Sub Example_Load() ' 该示例尝试从acad.lin文件中加载 "CENTER" 线型。如果该线型已经存在,则显示提示。 Dim linetypeName As String linetypeName = "center" ' 从acad.lin文件中加载 "CENTER"线型 On Error Resume Next ' 捕获任何出错信息 ThisDrawing.Linetypes.Load linetypeName, "acad.lin" ' 如果该名称已经存在,则提醒用户 If Err.Number = -2145386405 Then 'MsgBox "名称为“" & linetypeName & "”的线型已经存在。", , "明经通道VBA线型加载示例" End If Dim objLayer As AcadLayer Set objLayer = ThisDrawing.Layers.Add("aa") objLayer.Linetype = linetypeName End Sub |