Graph colors in excel

th3_pu7p

New Member
Joined
Mar 19, 2002
Messages
7
I was wondering if you were able to help me find out how to change the color of a graphs bar in Excel. I am using Progress (DataBase software) to populate the worksheet and then using another call to create a chart form the data in the worksheet.

I have tried using the ColorIndex to change the color of the graph, but failed, any ideas?
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
I cannot use a macro as I am using an external program. (i.e. Progress). This is what I have:

chChart = chExcelApplication:ActiveChart:ChartWizard(chWorksheet3Range, 2, 3, 2, 1, 0, FALSE, "Sales Analysis by Salesman","Saleman" ,"Litreage" ).

WHERE chChart is the handle that you use in Progress. The above code creates the table.
I need to do something like this below.
chChart = chExcelApplication:ActiveChart:Chart:ColorIndex = 2.
 
Upvote 0
I have compiled the marco and studied the code. It uses the Interior call, but for some reason Progress does not support it
i.e:

With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
 
Upvote 0
I am not suggesting you use the recorded macro I'm suggesting you use the code generated to work it out.


ActiveChart.SeriesCollection(1).Interior.ColorIndex = 27

Works just fine if the chart is active.
 
Upvote 0
Dave,
Yes thanks, I have been looking at the MSDN page and the information for that is there also. I was previously getting errors in Excel when I was making that call, but have fixed that, now the colours are simply not changing. Wierd.
 
Upvote 0
How did you stop the errors

On error resume next ?

If so this will only stop the code breaking and you MUST set it back with

On Error GoTo 0

Otherwise you will never get any debugs.
 
Upvote 0
No, it was communication calls between Progress and Excel. This is the code I have for the colour change, but it is not changing the colour of the bar. I have activated the correct chart.
chChart = chExcelApplication:ActiveChart:SeriesCollection(1):Interior:ColorIndex = 3.
Any ideas?
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,927
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top