Question

In MS Word 2010, changing the width of a merged cell is a bit tricksy.

Imagine a simple 2 x 2 table. The cells of the top row are merged, the cells of the second row are not.

If the cursor in placed in Cell(2, 1) (Using Word indices) and the width is changed, then the width of the top row will be changed to match that of the "Active" cell.

If, however, the selection is extended to include the "End of Row" hidden character, then change only affects the selected cell, as intended.

Does anyone know how to replicate this behaviour in VBA?

Cheers

Dan

Was it helpful?

Solution

Turns out that if you User Cell.Select then the behaviour is as I wanted

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top