Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Allocated memory exceeded error

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.

3 Replies
Not applicable
Author

Hi,

you can use Calculated Dimension and put the expression:

IF(GetFieldSelections(dimension) = 'name_name', name_name, rx_name)

Not applicable
Author

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.

Not applicable
Author

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