VBA函数在AutoCAD 2013中不起作用
我有一个VBA模块和一个函数,它基本上只是创建一个组。该功能在所有AutoCAD版本2008至2012上都可以正常工作,但在AutoCAD 2013中,它会崩溃并显示错误消息“运行时错误'-2147417856(800 10 100)”。这是函数:
Public Function CreateGroup(grpName As String) As AcadGroup
Dim colGroups As AcadGroups
Dim objGroup As AcadGroup
Set colGroups = ThisDrawing.Groups
On Error Resume Next
Set objGroup = ThisDrawing.Groups.Item(grpName)
' create the group
If Not objGroup Is Nothing Then
objGroup.Delete
End If
Set objGroup = ThisDrawing.Groups.Add(grpName)
' check if it was created
If objGroup Is Nothing Then
MsgBox "Unable to Add '" & grpName & "'"
End If
End Function
当我进入调试模式时,它停止在:
Set colGroups = ThisDrawing.Groups
我在两台计算机上测试了它,两台计算机上的结果相同。这似乎是2013年的一个问题。
还有其他人遇到过这个问题吗?
**** Hidden Message *****
页:
[1]