Dim acadapp As AcadApplication '在屏幕上取块
Set acadapp = GetObject(, "autocad.application")
Dim acaddoc As AcadDocument
Set acaddoc = acadapp.ActiveDocument
Dim entityset As AcadSelectionSet
'frm.hide
100 Set entityset = acaddoc.ActiveSelectionSet
entityset.Clear
entityset.SelectOnScreen
If entityset.Count = 0 Or entityset.Count > 1 Then
MsgBox "没有选择一个块或选择过多"
GoTo 100
End If '下面是取所选择的块
Dim obj As AcadEntity
Dim varattributes As Variant
Set obj = entityset.SelectOnScreen
If obj.ObjectName = "VM" Then 'VM是块的名称
If .HasAttributes Then
vaattributes = .GetAttributes
End If
End If