I have a QV pivot chart with 3 dimensions and 2 numerical expressions, vertically displayed as bars. The chart is sorted descending on the first expression. I can sort on the second by moving it up in the expression tab of the graphs properties sheet, but i want to make a button to have VB automatically perform this. I have tried the following, but it does not work
Set obj = ActiveDocument.GetSheetObject("CH03") Set props = obj.GetProperties Set exprs = props.Expressions Set tmp_0 = exprs.item(0) Set tmp_1 = exprs.item(1) exprs.item(1).copyfrom(tmp_0) exprs.item(0).copyfrom(tmp_1) End Sub
I would be really grateful if someone could tell me how to perform this in VB !
Hi Fredrik, thanks for your reply. I think yoyr suggestion is alright, but making a copy of an expression is not as simple as it might seem. Within the Graph class, there is method AddExpression, but it just has a text argument:
In this way, many properties of the expression are not copied as they are. In my post i also try to make a copy, but my method does not work. Thanks again though, and any other suggestion is welcome