Set Cell Padding on word tables with merged cells

A

andreas

Dear Experts:

Below macro sets certain padding values for the selected table.
Regrettably it fails to work on tables with merged cells. Have you got
any idea how to re-write the code so that tables featuring merged
cells also get worked on?

Help is much appreciated. Thank you very much in advance.

Regards, Andreas


Sub SetPadding

Dim myCell As Cell
Dim myRow As row
Dim myTable As Table

Set myTable = Selection.Tables(1)
For Each myRow In myTable.rows
For Each myCell In myRow.Cells
myCell.TopPadding = CentimetersToPoints(0)
myCell.BottomPadding = CentimetersToPoints(0)
myCell.LeftPadding = CentimetersToPoints(0.19)
myCell.RightPadding = CentimetersToPoints(0.19)
myCell.WordWrap = True
myCell.FitText = False

Next
Next

End Sub
 
G

Greg Maxey

Sub SetPadding()
Dim myCell As Cell
Dim myTable As Table
Set myTable = Selection.Tables(1)
For Each myCell In myTable.Range.Cells
With myCell
.TopPadding = CentimetersToPoints(0)
.BottomPadding = CentimetersToPoints(0)
.LeftPadding = CentimetersToPoints(0.29)
.RightPadding = CentimetersToPoints(0.29)
.WordWrap = True
.FitText = False
End With
Next myCell
End Sub
 
A

andreas

Sub SetPadding()
Dim myCell As Cell
Dim myTable As Table
Set myTable = Selection.Tables(1)
For Each myCell In myTable.Range.Cells
  With myCell
    .TopPadding = CentimetersToPoints(0)
    .BottomPadding = CentimetersToPoints(0)
    .LeftPadding = CentimetersToPoints(0.29)
    .RightPadding = CentimetersToPoints(0.29)
    .WordWrap = True
    .FitText = False
  End With
Next myCell
End Sub












- Show quoted text -

Hi Greg,

that's it! Great! Thank you very much for your professional help.

Regards, Andreas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top