yuanhui_hust 发表于 2011-6-1 20:36:35

把AutoCAD字导入excel

Sub dd()
   Dim elem As Object
   Dim xlApp As Excel.Application

    Dim xlBook As Excel.Workbook

    Dim xlSheet As Excel.Worksheet

    Set xlApp = CreateObject("Excel.application")
    Set xlBook = xlApp.Workbooks.Open("E:\123.xls")
    Set xlSheet = xlBook.Sheets(1)

   For Each elem In ThisDrawing.ModelSpace
      With elem
            If (elem.EntityName = "AcDbText") Or (.EntityName = "AcDbMText") Then

         xlSheet.cells(1, 1) = .TextString
         xlApp.Visible = True


            End If
      End With
      Set elem = Nothing
    Next elem
    End Sub

monkeylzx 发表于 2011-6-29 14:24:56

感谢分享,来参考一下
页: [1]
查看完整版本: 把AutoCAD字导入excel