Microsoft KB Archive/241508

= WD97: ParagraphFormat.Shading Shades Cells Black Instead of Selected Color =

Article ID: 241508

Article Last Modified on 1/25/2007

-

APPLIES TO


 * Microsoft Word 97 Standard Edition

-



This article was previously published under Q241508





SYMPTOMS
When you run a Visual Basic for Applications macro to shade text contained in a table cell, the text may be shaded with black instead of the color shading that you specified in your macro code.

For example, if you select the four center cells of a Word table with four rows and four columns, and then run the following Visual Basic for Applications macro code, the selected cells will be shaded black instead of red: With Selection.ParagraphFormat.Shading .ForegroundPatternColorIndex = wdRed .Texture = wdTextureSolid End With



WORKAROUND
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:

212536 OFF2000: How to Run Sample Code from Knowledge Base Articles

Use the Paragraphs.Format.Shading function instead of ParagraphFormat.Shading, as in the following example: Sub Test Dim pr As Paragraph For Each pr In Selection.Paragraphs With pr.Format.Shading .ForegroundPatternColorIndex = wdRed .Texture = wdTextureSolid End With Next End Sub



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Additional query words: vba table shading FormatParagraph ForegroundPatternColorIndex

Keywords: kbbug kbmacroexample kbnofix KB241508

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.