3 Replies Latest reply: Apr 19, 2013 3:50 AM by WANG Xu RSS

    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


        '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  


      end sub


      I'm attaching sample file.


      Please help me sort out this strange behaviour.