'检查图形中是否含有指定名称的组合的函数
Function GetGroup(GName As String) As Boolean
Dim objGroup As AcadGroup
On Error Resume Next
Set objGroup = ThisDrawing.Groups(GName)
If Err Then
GetGroup = False
Else
GetGroup = True
End If
End Function
'GetGroup函数使用示例
Sub GGroup()
Dim GName As String
GName = "liec"
Dim GroupTip As String
If GetGroup(GName) Then
GroupTip = "有"
Else
GroupTip = "无"
End If
MsgBox "图形中" & GroupTip & "名称为" & GName & "的组合存在", , "乐筑天下示例"
End Sub