01-05-2016 08:50 AM
Hey, I'm looking to change the line weight using ActiveX and invoke nodes in some excel charts that I have created. Each chart is in its own 'sheet' and each chart has 3 series. I only want to change the line weight on a specific chart and specific series. I understand the basic structure of using the invoke node after looking at examples, but I was wondering if it was possible to edit specific charts and specific series and how to go about doing so. From the examples I've seen it looks like for the most part they apply the changes to all series...any help is appreciated, thank you!
Solved! Go to Solution.
01-05-2016 10:29 AM
How far have you got in your code so far and can you post it?
Can you open Excel? Can you open the document? Can you switch to the correct sheet? Can you find the chart on the sheet you need to alter? Can you get the properties of that chart?
01-05-2016 10:33 AM
Heres what I have so far. Capture 1 is how I handle all the charts basic formating such as size titles and labels...Capture 2 is an attempt to access specific charts and series within the workbook.
01-05-2016 11:25 AM
I think that since you have 2 series, instead of getting a "Series" object back you're getting a "SeriesCollection" instead, so the variant casting there doesn't work properly. You can either try casting to a SeriesCollection instead of that and using the "Item" method with the correct Index input to get the Series object, or just wire an index to the SeriesCollection method in the first place.
And also as a general note, writing to the same property of an object within the same property node is generally not going to accomplish anything, as the first is immediately replaced by the second:
01-05-2016 12:03 PM
Alright I'll try that out, thank you for your time!
01-05-2016 12:06 PM
I still have one issue though, using these invoke nodes how do I specify what sheet I need to use in addition to specifying which series to make changes to?
01-05-2016 12:12 PM
@Zzimmha42 wrote:
I still have one issue though, using these invoke nodes how do I specify what sheet I need to use in addition to specifying which series to make changes to?
How about actually doing work and reading the Microsoft's Excel Developer Reference?
It is available online.
01-05-2016 12:19 PM
NYC,
I appreciate your condescending attitude, a link would've extra helpful but I'll go check it out. Thank you!
01-05-2016 07:40 PM
Use the Index variant input to get the Chartsheet you want to modify (idem for the series in the SeriesCollection). The index value can either be numeric (starting at 1 for the first chartsheet in the workbook) or the name of the chartsheet.
Ben64
01-06-2016 08:20 AM
Ben64,
Thank you very much for your help and the link. That info about the index was exactly what I needed, very much appreciated.