Forum Discussion
cdrgreg
Apr 10, 2026Copper Contributor
Table Styles and the Ribbon Table Design>Table Option Checkboxes
I have been dabbling in Word VBA for almost three decades but have a fairly limited practical use for Word so I rarely find myself dealing with Tables. However, the other day I got interested in Cha...
Kidd_Ip
Apr 11, 2026MVP
This is, this issue happened in Word 2019 and later versions, including Word 2021 and Microsoft 365.
https://learn.microsoft.com/en-us/office/vba/api/word.conditionalstyle
https://learn.microsoft.com/en-us/office/vba/api/word.tablestyle.condition
cdrgreg
Apr 12, 2026Copper Contributor
To get the code in the first link to actually work, you could combine the two. Still the Banded Columns and Total Row formatting will not be applied:
Sub ApplyConditionalStyle() With ActiveDocument .Tables(1).Select 'Assumes the table select is formatted with "Table Grid" style With .Styles("Table Grid").Table .ColumnStripe = 1 .RowStripe = 1 .Condition(wdOddColumnBanding).Shading _ .BackgroundPatternColor = wdColorGray10 .Condition(wdOddRowBanding).Shading _ .BackgroundPatternColor = wdColorGray10 .Condition(wdFirstRow).Borders(wdBorderBottom) _ .LineStyle = wdLineStyleDouble .Condition(wdFirstColumn).Borders(wdBorderRight) _ .LineStyle = wdLineStyleDouble .Condition(wdLastRow).Borders(wdBorderTop) _ .LineStyle = wdLineStyleDouble End With End With End Sub