All/Any:

Help! This is making me crazy…

I've got text above a table and text below it. I manually highlight
(selecting, then using the "Shading Color" button) the text and the table.
Instead of the table cells filling with color, the text takes the background
color.

I then search for any occurrence of BackgroundPatternColor in:
+ selection.range
+ selection.formattedtext
+ selection.paragraphs

None of these seem to be it. What am I missing? Or is this a bug
somewhere? (search code below)

Thanks!

-Jon


code:

Sub amItable()
With Selection
.HomeKey unit:=wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Format = False
.Text = ""
.Replacement.Text = ""
.Highlight = False

While .Execute(replace:=wdReplaceNone)

If Selection.Information(wdWithInTable) = True Then
MsgBox "I'm in a table!"
If Selection.Cells(1).Shading.BackgroundPatternColor <> _
wdColorAutomatic Then
MsgBox "I'm shaded in a table"
ElseIf Selection.Characters(1).Shading.BackgroundPatternColor <> _
wdColorAutomatic Then
MsgBox "I'm a shaded character in a table!"
ElseIf Selection.Paragraphs(1).Shading.BackgroundPatternColor <> _
wdColorAutomatic Then
MsgBox "I'm a shaded paragraph in a table!"
ElseIf Selection.Range.Shading.BackgroundPatternColor <> _
wdColorAutomatic Then
MsgBox "I'm a shaded range in a table!"
ElseIf Selection.Rows(1).Shading.BackgroundPatternColor <> _
wdColorAutomatic Then
MsgBox "I'm a shaded row in a table!"
ElseIf Selection.Shading.BackgroundPatternColor <> _
wdColorAutomatic Then
MsgBox "I'm a selection shading in a table"
End If

End If
Wend
End With
End With

Re: Word 2002: What can take backgroundpatterncolor? by jparadise

jparadise
Thu Aug 14 08:16:36 CDT 2003

> I've got text above a table and text below it. I manually highlight
> (selecting, then using the "Shading Color" button) the text and the table.
> Instead of the table cells filling with color, the text takes the background
> color.
>
> I then search for any occurrence of BackgroundPatternColor in:
> + selection.range
> + selection.formattedtext
> + selection.paragraphs
>
> None of these seem to be it. What am I missing? Or is this a bug
> somewhere? (search code below


Bad form, I know, replying to my own post. But I figured it out.

Selection.ParagraphFormat.Shading

Ah. Much better. I can sleep, now.

-j