Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I've got this annoying "Allocated memory exceeded" error while trying to dinamically add dimensions to pivot table.
When I'm adding them via GUI I get no errors at all.
Macro I'm using:
sub onSelectMacro
set chart = ActiveDocument.GetSheetObject("CH01")
' clean chart dimensions
set dims = chart.GetProperties.Dimensions
for i=0 to dims.Count - 1
chart.RemoveDimension 0
next
'add dimensions
chart.AddDimension "time_name"
set dimSelection = ActiveDocument.fields("dimension").GetSelectedValues
for i=0 to dimSelection.Count - 1
chart.AddDimension dimSelection.Item(i).text
next
end sub
I'm attaching sample file.
Please help me sort out this strange behaviour.
Hi,
you can use Calculated Dimension and put the expression:
IF(GetFieldSelections(dimension) = 'name_name', name_name, rx_name)
Thanks for your response!
I beleve your approach is usefull when there are only few dimensions. And unfortunately I've got at least dozen of them.
As a matter of fact. I've found that when I add these three lines to my macro it suddenly starts to work:
set props = chart.GetProperties
props.tableProperties.NumberOfLeftDimensions = dimSelection.Count
chart.SetProperties(props)
This approach do not affect web client, which is pity. I suspect it's a bug.
Hi, victor,
I've had the same problem. It works well with the code that you gave:) You save me a lot of time!
We can report this bug so that it could be fixed in the next release
Xu