WinWord 2.0: Macro to Remove Shading Does Not Work

ID: Q82958

The information in this article applies to:

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.

MORE INFORMATION

Steps to Reproduce Problem

Example 1: Shading in Table Cells

1. From the File menu, choose New, and choose the OK button.

2. From the Tools menu, choose Macro.

3. Type "UnShadeTable" (without the quotation marks) in the Macro Name

   box, and choose the Edit button.

4. In the macro-editing window, type the following macro:

      Sub Main
      TableSelectTable
      FormatBorder .FromText = "", .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

5. From the File menu, choose Close. Choose the Yes button when
   prompted to save changes to the macro.

6. 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.)

7. 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.

8. From the Tools menu, choose Macro, select UnShadeTable, and choose
   the Run button.

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

Example 2: Shading in Paragraphs

1. From the File menu, choose New, and choose the OK button.

2. From the Tools menu, choose Macro.

3. Type "UnShade" (without the quotation marks) in the Macro Name box,

   and choose the Edit button.

4. In the macro-editing window, type the following macro:

      Sub Main
      EditSelectAll
      FormatBorder .FromText = "1 pt", .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

5. From the File menu, choose Close. Choose the Yes button when
   prompted to save changes to the macro.

6. 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.)

7. From the Tools menu, choose Macro, select UnShade, and choose the
   Run button.

The macro runs, but the paragraph shading remains.

REFERENCES

"Microsoft Word for Windows User's Guide," version 2.0, page 377-379, 764-765

Kbcategory: kbusage kbmacro KBSubcategory: kbtable Additional query words: winword2 2.0 2.0a 2.0a-CD word6 winword 2.0b 2.0c

Keywords          : kbmacro kbusage kbtable 
Version           : 2.0 2.0a 2.0a-CD 2.0b 2.0c
Platform          : WINDOWS

Last Reviewed: July 31, 1997