I have a VBA module and a function in it which basically just creates a group. The function works fine on all AutoCAD versions 2008 to 2012, but in AutoCAD 2013 it crashes with an error message "Run time error '-2147417856 (800 10 100)".
Here's the function:
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
When I go into debug mode it stops on:
Set colGroups = ThisDrawing.Groups
I tested it on two computers with the same results on both. It would appear to be a problem with 2013.
Has anyone else encountered this problem?