vba - Excel: referencing a chart as ChartObjects & Chart vs Shapes -


i ran wall setting minimum- , maximumscale properties of chart's secondary axis - kept getting "object not have property" error. fixed it, i'd know how.

after many hours of googling , trying different options (three. 3 stupid hours), arbitrarily decided reference chart way of shapes collection instead of chartobjects collection, , worked.

so, good:

activesheet.shapes(1).chart.axes(xlvalue,xlsecondary).minimumscale = cmin 

and bad:

activesheet.chartobjects(1).chart.axes(xlvalue,xlsecondary).minimumscale = cmin 

but was able set other properties. e.g., following line of code worked:

activesheet.chartobjects(1).chart.axes(xlvalue,xlsecondary).axistitle.text = "current (a)" 

from msdn documentation, both shapes(1) , chartobjects(1) return chart object, yet couldn't access properties when accessed chart via chartobjects collection. is, able set properties within axes method when set chart

dim cht chart set cht = activesheet.shapes(1).chart 

but not if set chart as

dim cht chart set cht = activesheet.chartobjects(1).chart 

so question is, why discrepancy? hidden nuance of vba syntax, or more foible of machine?

excel 2013 on windows 7 box


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -