Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
i want to add a calculated dimension to a chart dynamically (via a macro), but it doesn't work
any idea ?
Sub TestFunc
set pchart = ActiveDocument.GetSheetObject("CH01")
pchart.addDimension " = if ( Product='AAA', Field1, Field2 ) "
set chartProperties = pchart.GetProperties
pchart.SetProperties chartProperties
end sub
what do you mean by doesn't work exactly
does it give an expression error? or is the macro failing to do anything
try with AGGR( Expression, Product) if it's an expression error
there's no expression error and no thing is added to the chart.
if I use pchart.addDimension "AField" it works but with the if.... it doesn't.
The following worked for me:
Sub TestFunc
set pchart = ActiveDocument.GetSheetObject("CH21")
pchart.addDimension "=if(Class='PivotTableBox', Classmember, Member)"
set chartProperties = pchart.GetProperties
pchart.SetProperties chartProperties
end sub
and this meant that the extra spaces within the expression-string caused the error.
- Marcus
doesn't work for me
maybe because I'm using a combo chart ?!