0

我有这些我经常得到的文档,我必须对其进行格式化,并且所有数据都存储在用于布局目的的较大表中的表中。

如果可以使用宏,我想设置表格中表格的列宽?

4

1 回答 1

4

您可以直接引用嵌套表。使用以下命令,您可以获得文档中第一个表中包含的表数。

Debug.Print ThisDocument.Tables(1).Tables.Count

然后,您可以遍历它们并根据需要对其进行格式化:

Dim oTable as Table

For Each oTable in ThisDocument.Tables(1).Tables

    'Do something with oTable - like
    'setting the width of the first column
    oTable.Columns(1).Width = 60

Next

不要忘记首先检查文档中是否有表格。:)

于 2012-08-16T09:32:46.270 回答