mccad 发表于 2003-3-10 19:51
Sub SelBlkSet()
Dim Blk As AcadBlockReference
Dim Ent As AcadEntity
Private Sub CommandButton1_Click()
Dim Blk As AcadBlockReference
Dim Ent As AcadEntity
Dim Pnt As Variant
Dim SelBlk As Boolean
Dim BlkName As String
On Error Resume Next
'选择对象并判断所选对象是否为图块
SelBlk = True
While SelBlk
ThisDrawing.Utility.GetEntity Ent, Pnt, "选择图块"
If Ent.ObjectName = "AcDbBlockReference" Then
Set Blk = Ent
BlkName = Blk.Name
SelBlk = False
End If
Wend
Debug.Print "选定的图块名称为“" & BlkName