我有一个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年的一个问题。
还有其他人遇到过这个问题吗?
本帖以下内容被隐藏保护;需要你回复后,才能看到! 游客,如果您要查看本帖隐藏内容请 回复 |