Microsoft KB Archive/242125

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

Article ID: 242125

Article Last Modified on 6/17/2005

-

APPLIES TO


 * Microsoft Word 2000 Standard Edition

-



This article was previously published under Q242125





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

To work around this problem, 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 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



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 kbnofix kbmacroexample KB242125

-

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

© Microsoft Corporation. All rights reserved.