- UID
- 107309
- 积分
- 5021
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2004-2-28
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
这里只输出了对象名,颜色,层名,线型
Sub outexcel()
Dim xlApp As Excel.Application
Dim xlbook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
On Error Resume Next
Set xlApp = GetObject(, "excel.application")
If Err <> 0 Then
Err.Clear
Set xlApp = CreateObject("excel.application")
If Err <> 0 Then
MsgBox "无法启动excel"
Exit Sub
End If
End If
Set xlbook = xlApp.Workbooks.Add
Set xlSheet = xlbook.ActiveSheet
xlApp.Visible = True
xlSheet.Cells(1, 1) = "对象名"
xlSheet.Cells(1, 2) = "颜色"
xlSheet.Cells(1, 3) = "层名"
xlSheet.Cells(1, 4) = "线型"
Dim i As Integer
For i = 0 To ThisDrawing.ModelSpace.Count - 1
With ThisDrawing.ModelSpace(i)
xlSheet.Cells(i + 2, 1) = .ObjectName
xlSheet.Cells(i + 2, 2) = .Color
xlSheet.Cells(i + 2, 3) = .Layer
xlSheet.Cells(i + 2, 4) = .Linetype
End With
Next
End Sub |
|