Skip to content

Instantly share code, notes, and snippets.

@erictleung
Created November 24, 2020 19:27
Show Gist options
  • Select an option

  • Save erictleung/f22a42e69ffcbfcfd6b807b0748f9ff2 to your computer and use it in GitHub Desktop.

Select an option

Save erictleung/f22a42e69ffcbfcfd6b807b0748f9ff2 to your computer and use it in GitHub Desktop.
Automate table formatting in Microsoft Word
' Inspired by
' https://github.com/jgm/pandoc/issues/3275#issuecomment-448262352
Sub TableDefaultOptions()
Dim tbl As Table
For Each tbl In ActiveDocument.Tables
tbl.Style = wdStyleTableLightGridAccent1
tbl.ApplyStyleFirstColumn = False
tbl.ApplyStyleLastColumn = False
tbl.ApplyStyleLastRow = False
tbl.ApplyStyleRowBands = True
tbl.ApplyStyleHeadingRows = True
tbl.PreferredWidth = 400
Next tbl
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment