- UID
- 25232
- 积分
- 2113
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-1-12
- 最后登录
- 1970-1-1
|
发表于 2004-11-24 17:41:00
|
显示全部楼层
那个主题中第二楼已说过“要引用”。
你要是不会,可先用下面的代码(不需要引用的):[php]
Sub test()
On Error Resume Next
Dim ent As Object
Dim pt As Variant
Dim att As Variant
Dim m As Integer
Dim xl As Object
Dim xb As Object
Dim xs As Object
On Error Resume Next
Set xl = GetObject(, "excel.application")
If Err Then
Err.Clear
Set xl = CreateObject("eccel.application")
If Err Then
MsgBox "excel isn't started"
Exit Sub
End If
End If
Set xb = xl.workbooks.Add
Set xs = xb.activesheet
ThisDrawing.Utility.GetEntity ent, pt, "select entity: "
While Err
Err.Clear
ThisDrawing.Utility.GetEntity ent, pt, "select entity: "
Wend
xl.Visible = True
xs.cells(1, 1) = ("Tag")
xs.cells(1, 2) = ("Text")
If ent.ObjectName = "AcDbBlockReference" Then
If ent.HasAttributes Then
att = ent.GetAttributes
For m = LBound(att) To UBound(att)
xs.cells(m + 2, 1) = att(m).TagString
xs.cells(m + 2, 2) = att(m).TextString
Next
End If
End If
End Sub[/php]
有VBA的问题应去VBA版询问。 |
|