07-21-2011 09:51 PM - edited 07-21-2011 09:53 PM
I am trying to change series color using Excel 2007 with ActiveX as below. It seems the color cannot be controlled correctly. For example, if I chosse red color, my curve will be changed to blue. Any ideas?
Also, I googled and found a guy ran into similiar problem using VBA for Excel 2007. See the link below:
http://help.wugnet.com/office/change-series-line-color-excel-2007-vba-ftopict1062646.html
Set ch = Worksheets("Chart").ChartObjects(1)
Set objSeries = ch.Chart.SeriesCollection(1)
objSeries.Format.Line.ForeColor.RGB = RGB(255, 127, 0)
According to the post, it need to be done as follows
objSeries.Border.Color = RGB(255, 127, 0) . But I cannot find the border property/method in ActiveX.
The color seems to be abitrary. and I found the
07-28-2011 06:13 PM
Xubuli,
I looked into your question and confirmed that Border.Color is not located under the Excel.Series library. Instead, you must locate it under _Worksheet.UsedRange as seen below in the figure. I am attaching the VI file where I located the the Border.Color property node, and I am also including a SubVI on the block diagram that goes into explicitly set the cell color and border. This SubVI can be found under Programming>>Report Generation>>Excel Specific>>Excel Format>>Excel Set Cell Color and Border.vi, if you have the Report Generation Toolkit installed. I hope this helps.
Larry H
02-24-2012 07:19 AM
Xubuli,
have you found a solution to this problem?? I have been wasting the best part of the last two days to solve this but no luck..
Thanks a lot,
Harry
02-24-2012 07:50 AM
Here is how we did it. We also created a color changer as the colors for LabVIEW are different thatn the colors for Excel.
Something else that you need to think about is that if you have a white color plot you need to change it in Excel if you are not making the graph background color something other than white.
02-24-2012 08:50 AM
Tim,
thanks a lot.. Sorted.. These excel activex sequences can be a pain sometimes..
Harry
06-26-2012 08:46 AM
I'm confused. I am trying to change the line color on a chart in excel using activex. I have been able to change the marker colors but not the lines.
I don't understand how Tim is getting Border as an option under Series property node. I don't have that as an option. Instead, I have tried changing the format, but it isn't working.
Excel 2007
What is wrong with this?
06-26-2012 09:40 AM
Hi,
I have attached the VI I made for plotting multi-curve graphs with configurable line and marker colours in Excel 2010.. I am pretty sure it should also work for excel 2007, too. FYI, In case you dont already know, excel 2007 has limitations with respect to maximum number of data cols and rows..
Apologies for not giving a more general example but its been a while now and this active-x thingy looks again pretty alien to me.. This VI includes lots of additional parameters which are useless to you but I have highlighted the part you are interested at, somewhere in the centre of the back panel.
Hopefully this will be of some help.. Open with LV 2009 or later.
Cheers,
Harry
06-26-2012 09:42 AM
@whatmorereason wrote:
I'm confused. I am trying to change the line color on a chart in excel using activex. I have been able to change the marker colors but not the lines.
I don't understand how Tim is getting Border as an option under Series property node. I don't have that as an option. Instead, I have tried changing the format, but it isn't working.
Excel 2007
What is wrong with this?
There is apparently a bug in Excel 2007.
The discussion with solution over at Microsoft forum. http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/2816660e-a18e-47f4-b121-02a71cb2c262
In LabVIEW, the solution would translate to
06-26-2012 10:05 AM
Thanks for the advice.
However, the variant to data conversion at the series select to border causes a type mismatch.
Any ideas?
06-26-2012 10:08 AM
I don't have a Chart to try this on.
You'll have to try different things to get it the LabVIEW code to match the C# code.