The VBA code sets the Word table properties.
Dim I as Table, N as Integer
On error Resume Next ' Ignore error
application.screenupdating = False ' Turn off screen update
For all I in activedocument.tables ' loops in the table
With I
. style = List Type 4 ' Sets all tables to list Type 4 '
With. Borders ' border
. InsideLineStyle = wdLineStyleSingle ' Set internal border line
End With
With. Rows (1). Borders (Wdborderbottom) ' The bottom border of the first row
. LineStyle = wdLineStyleDouble ' double line style
. LineWidth = wdlinewidth050pt
. Color = wdcolorautomatic
End With
If. Rows.Count > 1 Then ' If the number of table rows is greater than 1
If Len (. Cell (2, 1). Range) <= 2 Then ' If the first column of the second row is not empty
With. Rows (2). Shading ' Set shading
. Texture = Wdtexturenone ' bottomless shading
. ForegroundPatternColor = wdcolorautomatic
. BackgroundPatternColor = wdColorGray125
End With
End If
End If
For N = 2 to. Columns.count ' from the second column to the last column
. Columns (N). Select ' cell alignment centered in middle
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.Cells.VerticalAlignment = Wdcellalignverticalcenter
Next N
End With
Next I
application.screenupdating = True
The above code functions are: loops in the table collection and settings for the cell borders.