Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Powershell Excel Chart - change series colors

$
0
0

I have a Powershell script that reads values from an Excel sheet and then creates a chart based on the values. The script works but I want to change the colors of the series in the bar chart. In VB (using an Excel macro) the code is as follows:

  ActiveChart.SeriesCollection(7).Select
    With Selection.Format.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(17, 17, 17)
        .Solid
    End With

Based on what I read Powershell doesn't process RGB colors so I tried using one of the default colors:

$wb.ActiveChart.SeriesCollection(5).Format.Fill.ForeColor = "black"

Whatever variation on this I try seems to make no difference to the color of the bar chart series values. Is it even possible to change the colors with Powershell?


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>