I have a lot of (> 200) tables in Word that have the same layout (two columns, six rows).
I need to adjust the column widths for all of them. Is there a way to automate this?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityYou could use a VBA macro to resize every table.
Press ALT+F11 in Word and insert the macro under Project » ThisDocument.
Execute the code with F5
Sub resizeTables()
For Each Table In ActiveDocument.Tables
On Error Resume Next
Table.Columns(1).Width = 200
Table.Columns(2).Width = 300
On Error GoTo 0
Next
End Sub
Columns(2)
represents the column 2 in every tableWidth = 300
is your desired width in pixel. Change it to your needsOn Error Resume Next
to ignore errors and On Error GoTo 0
to stop this error handling