Skip to content

Instantly share code, notes, and snippets.

@r-plus
Created April 28, 2012 03:05
Show Gist options
  • Select an option

  • Save r-plus/2515348 to your computer and use it in GitHub Desktop.

Select an option

Save r-plus/2515348 to your computer and use it in GitHub Desktop.
modify the table style in MS-Word.
Sub ModifyTableStyle()
On Error Resume Next
For Each i In ActiveDocument.Tables()
' Stroke around table at bold single line.
With i.Borders(wdBorderTop)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth150pt
.Color = Options.DefaultBorderColor
End With
With i.Borders(wdBorderLeft)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth150pt
.Color = Options.DefaultBorderColor
End With
With i.Borders(wdBorderBottom)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth150pt
.Color = Options.DefaultBorderColor
End With
With i.Borders(wdBorderRight)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth150pt
.Color = Options.DefaultBorderColor
End With
' modify title row except merged cell contain table.
With i.Rows(1).Range()
.Font.Bold = True
.Font.Color = -603914241
.Shading.Texture = wdTextureNone
.Shading.ForegroundPatternColor = wdColorAutomatic
.Shading.BackgroundPatternColor = -603946753
With .Borders(wdBorderBottom)
.LineStyle = wdLineStyleDouble
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
End With
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment