Format Shape With ThemeColors

  • Thread starter Thread starter Roger
  • Start date Start date
R

Roger

I can format shapes with RGB
ActiveSheet.Shapes("Test").Fill.ForeColor.RGB = RGB(128, 128, 128)
Is there a way to format a shape using themecolors in the same way you can
format a cell
With Range("A1").Interior
.ThemeColor = xlThemeColorAccent3
.TintAndShade = 0.799981688894314
End With
I have tried every variation of the code & syntax to no avail - could
someone give me an example of the code to do this please - thankyou in
anticipation
 
This is the sort of syntax you are looking for:

ActiveSheet.Shapes.Range(Array("Test")).Select
With Selection.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent3
.ForeColor.TintAndShade = 0.8
.Transparency = 0
.Solid
End With
With Selection.ShapeRange.Line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent6
.ForeColor.TintAndShade = 0.4
.Transparency = 0
End With

You can drop things like transparency and solid if you won't need to
change them, but sometimes it is better to be sure (eg colours will look
wrong if the transparency is not 0).
For TintAndShade I tend to use rounded numbers, although they won't
exactly match the choices in the gallery (but it also means you have
easy access to a wider range if you want to, while remaining 'theme aware')

Hope this helps

Adam
 
Back
Top