- 积分
- 5987
- 明经币
- 个
- 注册时间
- 2006-7-8
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2007-12-14 13:11:00
|
显示全部楼层
本帖最后由 作者 于 2007-12-14 14:49:55 编辑
- Sub Ss()
-
- Dim xlSheet
- Set xlSheet = xlApp.sheets(2)
-
-
- Dim ColNum, RowNum, pp(0 To 2) As Double, RowColText
- Dim Ent As AcadEntity, tt As AcadText
- ColNum = Array(0, 10, 24, 44, 52, 61, 69, 77, 86, 94, 103, 111, 119, 128, 136, 145, 153, 161, 170, 178)
- ReDim Preserve ColNum(UBound(ColNum))
-
- RowNum = Array(0, 5, 11, 16, 22, 27, 32, 38, 43) ', 45, 48, 55)
- RowCount = UBound(RowNum)
- ReDim Preserve RowNum(UBound(RowNum))
- ReDim RowColText(UBound(RowNum) - 1, UBound(ColNum) - 1)
- For Each Ent In ThisDrawing.ModelSpace
- Select Case Ent.ObjectName
- Case "AcDbText"
- Set tt = Ent
-
- For ii = 0 To UBound(ColNum) - 1
- If tt.InsertionPoint(0) > ColNum(ii) And tt.InsertionPoint(0) < ColNum(ii + 1) Then
- 'Debug.Print ii + 1, tt.InsertionPoint(0)
- ColNumCount = ii
- Exit For
- End If
- Next ii
-
- For jj = 0 To UBound(RowNum)
- If tt.InsertionPoint(1) > RowNum(jj) And tt.InsertionPoint(1) < RowNum(jj + 1) Then
- 'Debug.Print jj + 1, "-----", tt.InsertionPoint(1)
- RowNumCount = jj
- Exit For
- End If
- Next jj
- RowColText(RowNumCount, ColNumCount) = tt.TextString
- ' xlSheet.Cells(RowNumCount + 1, ColNumCount + 1).Value = tt.TextString
- End Select
-
- Next Ent
- xlSheet.Range("A2").Resize(RowCount, 19).Value = RowColText
- Columns("A:S").Select
- Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
- OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
- :=xlPinYin, DataOption1:=xlSortNormal
- Debug.Print
- End Sub
|
|