I recorded a test macro just now to shade selected cells to 5%. It's a
macro I'll need enough to keep but the recorded keystrokes include a lot of
garbage I don't need. There may be tables that have different attributes,
etc., than what I recorded the macro with that will get changed. Here's the
recording:
**********************
Sub Macro1()
'
With Selection.Cells
With .Shading
.Texture = wdTextureNone
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorGray05
End With
With .Borders(wdBorderLeft)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderRight)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderTop)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderBottom)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderHorizontal)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
With .Borders(wdBorderVertical)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
.Borders.Shadow = False
End With
With Options
.DefaultBorderLineStyle = wdLineStyleSingle
.DefaultBorderLineWidth = wdLineWidth050pt
.DefaultBorderColor = wdColorAutomatic
End With
End Sub
**********************
I'm guessing here but it seems that the line near the beginning of the code
that is this:
.BackgroundPatternColor = wdColorGray05
is what actually did the shading? Is there a way to have a macro to just
shade rather than all the rest? Pls advise and thanks. :oD
Your guess is good and, yes, just remove the bits you don't want:
Sub Macro1()
'
With Selection.Cells
With .Shading
.Texture = wdTextureNone
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorGray05
End With
End With
End Sub
--
Enjoy,
Tony
> I recorded a test macro just now to shade selected cells to 5%. It's a
> macro I'll need enough to keep but the recorded keystrokes include a lot of
[quoted text clipped - 60 lines]
> is what actually did the shading? Is there a way to have a macro to just
> shade rather than all the rest? Pls advise and thanks. :oD
StargateFan - 02 Nov 2005 03:55 GMT
>Your guess is good and, yes, just remove the bits you don't want:
Super. :oD
>Sub Macro1()
>'
[quoted text clipped - 6 lines]
> End With
>End Sub
Thank you. I've just emailed myself at the office with that snippet
of code so I have it first thing tomorrow.
Thanks. :oD
>--
>Enjoy,
[quoted text clipped - 67 lines]
>> is what actually did the shading? Is there a way to have a macro to just
>> shade rather than all the rest? Pls advise and thanks. :oD