Alastair
Mon Mar 14 15:12:00 CST 2005
Helmut,
Thanks for your input. It may take me quite a while to go through your code
and I am glad that I asked a question that got you-a-thinking. I don't think
it will be long before I ask another question.
Thanks...
Alastair
"Helmut Weber" <elmkqznfwvccbf@mailinator.com> wrote in message
news:ftib31ts6fqgfajudubq3fhgrt05j3tlo2@4ax.com...
> Hi Alastair,
>
> in case you'd like to look deeper:
>
> Sub CellOrTextOrNoneOfThemShaded()
> Dim oCll As Cell ' object Cell
> Dim sCll As String ' string Cell
> ActiveDocument.Tables(1).Columns(1).Select
> ' selection might be more often, not to say always,
> ' faster than ranges in tables
> For Each oCll In Selection.Cells
>
> If TextHasShading(oCll.Range) And CellHasShading(oCll.Range) Then
> MsgBox Left$(sCll, Len(sCll) - 2)
> End If
> If TextHasShading(oCll.Range) Or CellHasShading(oCll.Range) Then
> sCll = oCll.Range.Text
> MsgBox Left$(sCll, Len(sCll) - 2)
> End If
> Next
> End Sub
> ' ---
> Public Function TextHasShading(oRng As Range) As Boolean
> Dim lBckTxt As Long ' BackgroundPatternColor of text
> Dim lFrgTxt As Long ' ForeroundPatternColor of text
> Dim lTxtTxt As Long ' Texture of text
>
> With oRng
> lBckTxt = .Font.Shading.BackgroundPatternColor
> lFrgTxt = .Font.Shading.ForegroundPatternColor
> lTxtTxt = .Font.Shading.Texture
> End With
> If lBckTxt < 0 And lFrgTxt < 0 And lTxtTxt = 0 Then
> TextHasShading = False
> Else
> TextHasShading = True
> End If
> End Function
> ' ---
> Public Function CellHasShading(oRng As Range) As Boolean
> Dim lBckCll As Long ' BackgroundPatternColor of Cell
> Dim lFrgCll As Long ' ForeroundPatternColor of Cell
> Dim lTxtCll As Long ' Texture of Cell
>
> With oRng
> lBckCll = .Shading.BackgroundPatternColor
> lFrgCll = .Shading.ForegroundPatternColor
> lTxtCll = .Shading.Texture
> End With
> If lBckCll < 0 And lFrgCll < 0 And lTxtCll = 0 Then
> CellHasShading = False
> Else
> CellHasShading = True
> End If
> End Function
>
> At least I enjoyed it.
>
> Greetings from Bavaria, Germany
>
> Helmut Weber, MVP
> "red.sys" & chr(64) & "t-online.de"
> Word XP, Win 98
>
http://word.mvps.org/
>
>