I'm looking for a way to quickly format groups of tables in documents. Unfortunately I can't just format all tables as I have to leave some unmodified (usually in the appendices, but sometimes at the beginning).
What I have so far will allow me to format all tables from Table 4 to the end. I can't figure out how to select tables 4 through 78 for example. I also need all of the cells to be vertically oriented in the middle. I've spent an ungodly amount of my life formatting each individual table, so any help would be GREATLY APPRECIATED.
Sub FormatTables()
Dim TableIndex As Long
Dim Mytable As Table
For TableIndex = 4 To ActiveDocument.tables.Count
Set Mytable = ActiveDocument.tables(TableIndex)
With Mytable
.Range.Style = ActiveDocument.Styles("TableText Arial 9")
.PreferredWidthType = wdPreferredWidthPercent
.PreferredWidth = 100
.Rows.Alignment = wdAlignRowCenter
.Rows.Height = InchesToPoints(0)
.TopPadding = InchesToPoints(0)
.BottomPadding = InchesToPoints(0)
.LeftPadding = InchesToPoints(0.08)
.RightPadding = InchesToPoints(0.08)
.Spacing = 0
.AllowPageBreaks = True
.AutoFitBehavior (wdAutoFitWindow)
End With
Next TableIndex
End Sub
question from:
https://stackoverflow.com/questions/65947672/can-i-select-a-group-of-tables-to-format-in-microsoft-word-using-vba 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…