谢谢您的耐心指教。
我试过了。用消息框检测到程序只执行到斜体部分。后一个循环没有执行。
[I]Sub ts() On Error Resume Next Dim i As AcadEntity dim j as AcadEntity Dim objs As New Collection For Each i In ThisDrawing.ModelSpace objs.Add i.ObjectName, i.ObjectName Next i[/I]
For Each j In objs MsgBox j Next j End Sub