Microsoft KB Archive/82958

{|
 * width="100%"|

WinWord 2.0: Macro to Remove Shading Does Not Work

 * }

Q82958

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c

-

SYMPTOMS
If you create a macro in Microsoft Word for Windows select multiple paragraphs and remove any shading in the selection, the macro does not remove the shading unless the entire selection is shaded. If the entire selection contains shading, the macro removes the shading correctly; however, if only a part of the selection contains shading, the macro does not remove the shading.

STATUS
Microsoft has confirmed this to be a problem in the versions of Microsoft Word for Windows listed above. We are researching this problem and will post more information here in the Microsoft Knowledge Base as it becomes available.

Example 1: Shading in Table Cells
 From the File menu, choose New, and choose the OK button. From the Tools menu, choose Macro. Type UnShadeTable in the Macro Name box, and choose the Edit button.  In the macro-editing window, type the following macro:      Sub Main TableSelectTable FormatBorder .FromText = &quot;&quot;, .ApplyTo = 3, .Shadow = 0, \ .TopBorder = 0, .LeftBorder = 0, .BottomBorder = 0, \ .RightBorder = 0, .HorizBorder = 0, .VertBorder = 0, \ .TopColor = 0, .LeftColor = 0, .BottomColor = 0, \ .RightColor = 0, .HorizColor = 0, .VertColor = 0, \ .Pattern = 0, .Foreground = 0, .Background = 0 End Sub  From the File menu, choose Close. Choose the Yes button when prompted to save changes to the macro. In the document, create a multi-column, multi-row table. (From the Table menu, choose Insert Table; or, choose the Table button on the tool bar.) Select several cells in the table. From the Format menu, choose Border, select a border, then choose the Shading button. Select the Custom option button, select an percentage from the Pattern box, and choose the OK button twice. From the Tools menu, choose Macro, select UnShadeTable, and choose the Run button.</li></ol>

Word removes the borders from the cells, but the shading remains.

Example 2: Shading in Paragraphs
<ol> From the File menu, choose New, and choose the OK button.</li> From the Tools menu, choose Macro.</li> Type UnShade in the Macro Name box, and choose the Edit button.</li>  In the macro-editing window, type the following macro: <pre class="CODESAMP">     Sub Main EditSelectAll FormatBorder .FromText = &quot;1 pt&quot;, .ApplyTo = 0, .Shadow = 0, \ .TopBorder = 0, .LeftBorder = 0, .BottomBorder = 0, \ .RightBorder = 0, .HorizBorder = 0, .VertBorder = 0, \ .TopColor = 0, .LeftColor = 0, .BottomColor = 0, \ .RightColor = 0, .HorizColor = 0, .VertColor = 0, \ .Pattern = 0, .Foreground = 0, .Background = 0 End Sub </li> From the File menu, choose Close. Choose the Yes button when prompted to save changes to the macro.</li> In the document, type four paragraphs, and apply different amounts of shading to each paragraph. (From the Format menu, choose Border, then choose the Shading button to access the Shading dialog box.)</li> From the Tools menu, choose Macro, select UnShade, and choose the Run button.</li></ol>

The macro runs, but the paragraph shading remains.