![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 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? |
|
|
|
|
|
#2 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Hi Th3_Pu7P
Did you try recording a macro and studying the code? |
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2002
Posts: 7
|
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. |
|
|
|
|
|
#4 |
|
New Member
Join Date: Mar 2002
Posts: 7
|
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 |
|
|
|
|
|
#5 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
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. |
|
|
|
|
|
#6 |
|
New Member
Join Date: Mar 2002
Posts: 7
|
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. |
|
|
|
|
|
#7 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
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. |
|
|
|
|
|
#8 |
|
New Member
Join Date: Mar 2002
Posts: 7
|
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? |
|
|
|
|
|
#9 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
what is the
"chChart =" at the start for? |
|
|
|
|
|
#10 |
|
New Member
Join Date: Mar 2002
Posts: 7
|
chChart is the handle that Progress uses to call the functions on this Excel Graph.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|