Tech Support Forum banner
Status
Not open for further replies.
1 - 3 of 3 Posts

· Registered
Joined
·
17 Posts
Discussion Starter · #1 ·
Hi all,

i got a code to clear or modify table cell padding in word like left and right

but i want to edit on it to reverse the value between Right and left on all tables on a word document


Sub ClearTablePadding()
Application.ScreenUpdating = False
Dim Tbl As table, Cel As Cell
With ActiveDocument
For Each Tbl In .Tables
With Tbl
.LeftPadding = 0
.RightPadding = 0
End With
For Each Cel In Tbl.Range.Cells
With Cel

.LeftPadding = 0
.RightPadding = 0
End With
Next
Next Tbl
End With
Set Cel = Nothing: Set Tbl = Nothing
Application.ScreenUpdating = True
End Sub

Thanks in advance
 

· Moderator , Microsoft Support, MS Office Pro
Joined
·
2,557 Posts
Try:
Code:
Sub SwapCellPadding()
Application.ScreenUpdating = False
Dim Tbl As Table, Cel As Cell, sngPad As Single
For Each Tbl In ActiveDocument.Tables
  With Tbl
    For Each Cel In Tbl.Range.Cells
      With Cel
        sngPad = .LeftPadding
        .LeftPadding = .RightPadding
        .RightPadding = sngPad
      End With
    Next
    sngPad = .LeftPadding
    .LeftPadding = .RightPadding
    .RightPadding = sngPad
  End With
Next Tbl
Set Cel = Nothing: Set Tbl = Nothing
Application.ScreenUpdating = True
End Sub
 
1 - 3 of 3 Posts
Status
Not open for further replies.
Top