How to hide table styles on the Table Tools Design tab in Word (for developers)
The problem: does anyone need 99 ways to format a table?
In Word 2007 and Word 2010, when you click within a table, two Table Tools contextual tabs become available on the Ribbon.
The Design tab includes the Table Styles group. This gives you, out of the box, 99 table styles from which to choose.
Having applied one of the 99 styles, the user can then choose whether or not to show banded columns, banded rows, header or total rows and so on.
In a corporate environment, the communications people would tear their hair out if users formatted tables in 99 different ways. A corporate environment is likely to have 2 or 3 'approved' ways to format a table.
The solution: hide most, if not all, of the built-in table styles
Well-constructed templates for corporate use are likely to have 2 or 3 custom table styles that fit the corporate branding. Or, the in-house rules may be that 2 or 3 of the built-in styles are to be used, but the rest are off limits.
There is no way in the user interface to hide the built-in table styles.
But you can do it in code. Something like this will do the trick:
Sub HideATableStyle() With ActiveDocument.Styles(Word.wdStyleTableLightShading) .Visibility = True ' Yes, True. .UnhideWhenUsed = False End With End Sub
If you're creating a template for corporate use, it may be appropriate to hide most of the built-in table styles in the template. Leave the approved custom or built-in table styles visible. Users can then easily apply the corporate-approved table styles when working on documents based on that template.
But… there is a disadvantage to this method. If the user copies a table from another document, and that table has your hidden style applied to it, then the user cannot see what style has been applied to the table. To avoid that, use something like this:
Sub HideATableStyleButMakeItVisibleWhenUsed() With ActiveDocument.Styles(Word.wdStyleTableLightShading) .Visibility = True ' Yes, True. .UnhideWhenUsed = True End With End Sub