0

在 MS Word 2010 中,更改合并单元格的宽度有点棘手。

想象一个简单的 2 x 2 表。第一行的单元格被合并,第二行的单元格不被合并。

如果光标放在 Cell(2, 1) 中(使用 Word 索引)并且宽度发生了变化,那么顶行的宽度将被更改以匹配“活动”单元格的宽度。

但是,如果选择扩展为包括“行尾”隐藏字符,则更改只会影响选定的单元格,如预期的那样。

有谁知道如何在 VBA 中复制这种行为?

干杯

4

1 回答 1

0

事实证明,如果你 User Cell.Select 那么行为就是我想要的

With Selection.Table(1)
    .Cell(1, 1).Select
    .Selection.Cells.Width = MillimetersToPoints(150)
    .Cell(2, 1).Select
    .Selection.Cells.Width = MillimetersToPoints(150)
    .Cell(3, 1).Select
    .Selection.Cells.Width = MillimetersToPoints(50)
    .Cell(3, 2).Select
    .Selection.Cells.Width = MillimetersToPoints(100)
End With
于 2011-12-01T14:31:03.777 回答