请教高手:¥¥¥¥¥未找到主键
Sub aa()Dim a As Object
Dim b As Object
Dim c As Object
Dim filterType(0) As Integer, filterData(0) As Variant
Dim sset As AcadSelectionSet
Set a = CreateObject("excel.application")
Set b = a.Workbooks.Add
Set c = b.Worksheets(1)
Set sset = ThisDrawing.SelectionSets.Item("ToExcel")
filterType(0) = 0
filterData(0) = "line,circle,point"
sset.SelectOnScreen filterType, filterData
c.Range("A1") = "ObjectCount" '写入标题
c.Range("B1") = sset.Count '写入数据
Dim Obj As AcadEntity, i As Long, varCP As Variant
i = 2
For Each Obj In sset
Select Case Obj.ObjectName
Case "AcDbLine"
c.Range(("A" & i)) = "111" '写入对象名
End Select
i = i + 1
Next
a.Visible = True
End Sub
本帖最后由 chmenf087 于 2011-1-12 19:09 编辑
thisdrawing对象里面没有选择集
请先创建一个选择集
Set a = CreateObject("excel.application")
Set b = a.Workbooks.Add
Set c = b.Worksheets(1)
If Not IsNull(ThisDrawing.SelectionSets.Item("ToExcel")) Then
Set sset = ThisDrawing.SelectionSets.Item("ToExcel")
sset.Delete
End If
Set sset = ThisDrawing.SelectionSets.Add("ToExcel") 回复 chmenf087 的帖子
多谢指点,能否给个QQ号,交个朋友
页:
[1]