Sub linetyeExist()
Dim linetypeName As String
linetypeName = "CENTER"
On Error Resume Next
ThisDrawing.Linetypes.Load linetypeName, "acad.lin"
If Err.Description = "Duplicate record name" Then
MsgBox "线型名为" & linetypeName & "' 的线型已存在"
End If
End Sub
原来一句 On Error Resume Next 就搞定了!非常感谢azjmjsj
中文版的CAD应该这样写:
Sub linetyeExist()
Dim linetypeName As String
linetypeName = "CENTER"
On Error Resume Next
ThisDrawing.Linetypes.Load linetypeName, "acad.lin"
If Err.Description = "记录名重复" Then
MsgBox "线型名为" & linetypeName & "' 的线型已存在"
End If
End Sub