Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I run into problems when I try to create a macro to set the sort order in a chart .
The follwoing code works fine:
Set chart = ActiveDocument.GetSheetObject("CH10")
Set prop = chart.GetProperties
Prop.Dimensions(0).SortCriteria.SortByAscii = 0
Prop.Dimensions(0).SortCriteria.SortByExpression = 0
Prop.Dimensions(0).SortCriteria.SortByFrequency = 0
Prop.Dimensions(0).SortCriteria.SortByLoadOrder = 0
Prop.Dimensions(0).SortCriteria.SortByState = 0
But when I test with this:
Prop.Dimensions(0).SortCriteria.SortByYValue = 0
I get an error telling me that "SortByYvalue" is not a valid method/property. But according to the API guide, there is a member called SortByYValue.
I hope somebody can give me a hint.
Thanks,
I looked closer into the API description...
SortByYValue is different from the rest of Sorting APIs - it belongs to IGraphProperties and not to ISourtCriteria. You can set it for the whole chart but not for an individual Dimension
Oleg
SortByYValue might not be available for all charts. Try setting the sort order manually for your chart. If you can't set sort by Y Value manually, you won't be able to do it via macro.
Oleg
Thanks for your reply. I can set it manually. It's an ordinary bar chart with one dimension and one calculated expression.
/Anders
I looked closer into the API description...
SortByYValue is different from the rest of Sorting APIs - it belongs to IGraphProperties and not to ISourtCriteria. You can set it for the whole chart but not for an individual Dimension
Oleg
Thanks, Oleg!