You should also understand that if you run the macro on a table where cells have been merged vertically, you may get unexpected results, if any. You can also change the amount of shading by changing the wdTexture20Percent constant to another, such as wdTexture5Percent, wdTexture10Percent, wdTexture25Percent, etc. Simply change the single line, in this manner:
MICROSOFT WORD CREATE HEADER USING BANDED STYLE MOD
You can also change the frequency of shading (for instance, from every third row to every fourth) by changing the Mod formula.
If the insertion point is not within a table when the macro is run, then nothing happens. The macro asks how many header rows are in the table, and then adjusts the rows to which it applies shading. Selection.Tables(1).Rows(iRow + iHeads).Shading.Texture _ IRowTtl = Selection.Tables(1).Rows.Count - iHeads IHeads = InputBox(prompt:="Number of heading rows?", _ If Selection.Information(wdWithInTable) = True Then The following is a good example of a macro that can apply shading to every third row in a table: In these instances it may be best to use a macro to do your formatting. They don't work so well if you want the formatting applied to every third, fourth, or fifth row or if you are using an older version of Word that doesn't include table formatting. The solutions described so far work great if you want to apply formatting to every other row in a table, and provided you are using a version of Word that supports table formatting. The formatting automatically adjusts as you change the number of rows in the table. You can apply this style to the table, as desired. You've now created a shading style for either odd or even rows. Set the style name and other properties, as desired.Use the controls in the dialog box to set the formatting you want applied to the rows.Using the Apply Formatting To drop-down list, choose Odd Row Stripes or Even Row Stripes, depending on whether you want this style to apply to odd or even rows.Using the Style Type drop-down list, choose Table.Word displays the Styles and Formatting task pane. Choose Styles and Formatting from the Format menu.(This is how the Table AutoFormats do it.) Follow these steps: You can define a table style that automatically applies shading to either the even or odd rows in a table. One of the relatively recent additions to Word's style capabilities is styles for tables. Styles have been available in Word for years and years. How is this done? Glad you asked that leads to the second method of shading table rows-table styles.
Many of the AutoFormats provided for tables are "smart," meaning that they can adjust row shading even if you add new rows to the table.