I am trying to build some custom themes for excel charts in a dashboard. Upon recording a macro to see how these are implemented, the macro recorded the following code;
ActiveChart.ClearToMatchStyle
ActiveChart.ChartStyle = 268
I have searched high and low via google to find a list of these chartstyles, or any documentation on how to customize them. Every search returns links for the chart type constants, i.e. xlLine, xlPie etc. NOT the themed charts available on the Chart Tools-Design tab in the Excel ribbon.
If anyone can point me in the right direction it would be much appreciated.
EDIT:
There is minimal to no documentation available for these Chart Style constants, so I created a sample workbook with all of the Chart Style types displayed as pie charts. It is available for you here. at least you will have a visual representation of the chart prior to choosing the type.
The workbook can be viewed here, if anyone knows how to add a downloadable version in the post please comment
You can build it yourself with the following code, just add a sheet named ChartStyles and create a data table named GolfRoundsPlayed and use this data
Month Rounds Played Jan 42 Feb 53 Mar 77 Apr 124 May 198 Jun 288 Jul 312 Aug 303 Sep 264 Oct 149 Nov 54 Dec 33
Sub BuildChartStyleSheet()
Dim targetChart As Chart
Dim targetSheet As Worksheet
Dim top As Long
Dim x As Integer, chtTitle As String
top = 15
Dim dataRange As Range
Set dataRange = Range("GolfRoundsPlayed")
Set targetSheet = Sheets("ChartStyles")
Application.ScreenUpdating = False
For x = 1 To 353
If x > 1 Then top = top + 128
On Error Resume Next
Set targetChart = targetSheet.Shapes.AddChart2(x, xlPie, 2, top, 230, 125).Chart
chtTitle = "ChartStyle for ChartStyle #" & x
With targetChart
.SetSourceData Source:=dataRange
.chartTitle.Text = chtTitle
.chartTitle.Format.TextFrame2.TextRange.Font.Size = 11
End With
Next x
Application.ScreenUpdating = True
End Sub