|
楼主 |
发表于 2020-9-24 22:51
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
在Word文档的立即窗口中查看:
- Sub WordTab()
- Dim MyDoc As Document
- Set MyDoc = Word.ActiveDocument
- Dim tb1 As Table, tb2 As Table, tbCell As Cell
- With MyDoc
- For Each tb1 In .Tables
- If tb1.Tables.Count > 0 Then
- For Each tbCell In tb1.Range.Cells
- Debug.Print tbCell.RowIndex, tbCell.ColumnIndex, tbCell.Range.Text
- 'Debug.Print tb1.NestingLevel
- Next
- For Each tb2 In tb1.Tables
- Call binb(tb2)
- Next
- Else
- For Each tbCell In tb1.Range.Cells
- Debug.Print tbCell.RowIndex, tbCell.ColumnIndex, tbCell.Range.Text
- 'Debug.Print tb1.NestingLevel
- Next
- End If
- Next
- End With
- End Sub
- Sub binb(tb As Table)
- Dim tb1 As Table, tbCell2 As Cell
- If tb.Tables.Count > 0 Then
- For Each tbCell2 In tb.Range.Cells
- Debug.Print vCel2.RowIndex, vCel2.ColumnIndex, vCel2.Range.Text
- Next
- For Each tb1 In tb.Tables
- Call binb(tb1)
- Next
- Else
- For Each tbCell2 In tb.Range.Cells
- Debug.Print tbCell2.RowIndex, tbCell2.ColumnIndex, tbCell2.Range.Text
- Next
- End If
- End Sub
复制代码
|
|