要不是今天检查零回复贴子,还不知道呢? 好象楼主的主题有些问题,不过,我只想从WORD的角度去考虑,我也写了一个代码 ,请楼主感兴趣时测试一下: '* +++++++++++++++++++++++++++++
'* Created By I Love You_Word!@ExcelHome 2005-9-11 20:38:10
'仅测试于System: Windows NT Word: 10.0 Language: 2052
'№ 00016^The Code CopyIn [ThisDocument-ThisDocument]^'
'* -----------------------------Option Explicit
Option Base 1 '数组的下标从1开始
Sub Example()
Dim i As Table, aRow As Row, MyArray() As String, CC As Byte
Dim aCell As Cell
Application.ScreenUpdating = False '关闭屏幕更新
With ThisDocument
For Each i In .Tables '在表格中循环
If i.Uniform Then '如果没有合并单元格
CC = i.Columns.Count '取得列表格列数
ReDim MyArray(CC) '声明一个动态数组
For Each aRow In i.Rows '在行中循环
'如果行的底边框为无线条
If aRow.Borders(wdBorderBottom).LineStyle = wdLineStyleNone Then
'在该行的单元格中循环
For Each aCell In aRow.Cells
'数组元素累加
MyArray(aCell.ColumnIndex) = MyArray(aCell.ColumnIndex) & VBA.Left(aCell.Range, Len(aCell.Range) - 2)
Next
aRow.Delete '删除此行
Else '如果有底部边框线
For Each aCell In aRow.Cells '在该行的单元格中循环
'在单元格的文本前插入上述相应的数组元素
aCell.Range.InsertBefore MyArray(aCell.ColumnIndex)
Next
Erase MyArray '清空数组
ReDim MyArray(CC) '重新定义该动态数组
End If
Next
End If
Next
End With
Application.ScreenUpdating = True
End Sub
'---------------------- |