Change color of lines in Excel chart from script

I have a working script that takes data from various views, exports it to Excel, creates a Line Chart and pastes the resulting chart into a document. All this works fine.

Of course now the users decided that they don’t like the default colors of the lines and want them changed to something else.

I have tried everything I can think of after using the macro recorder to get the Excel code, but the methods do not translate into script.

I have tried

.Series.Collection(1).MarkerBackgroundColorIndex = xlNone

.Series.Collection(1).MarkerForegroundColorIndex = xlNone

.Series.Collection(1).Border.ColorIndex = 53 (which should be something other than the default pink)

The error is something along the lines of “ColorIndex does not exist”.

Has anyone done this and gotten it to work?

Subject: Change color of lines in Excel chart from script

Use a constant or a number, like:

xlsheet.Cells( 5, “Q” ).Interior.ColorIndex = 34

xlsheet.Cells( fRow, x+1 ).Borders(7).ColorIndex = -4105

Subject: RE: Change color of lines in Excel chart from script

Thanks for the try, but I am talking about a chart object, not a sheet or cell object.

Subject: Change color of lines in Excel chart from script

Hi Roy, I use interior.colorindex like this

xlw.activesheet.Cells(row, col).interior.colorindex = 6 (for example)

Subject: Change color of lines in Excel chart from script

your code treats xlnone as a variable so the result will be null. trySeries.Collection(1).MarkerForegroundColorIndex = “xlNone”

Subject: RE: Change color of lines in Excel chart from script

Actually the problem is still MarkerForegroundColorIndex is an unknown as far as the script is concerned. I cannot get it to work regardless of how I wrap the xlNone.