1 Reply Latest reply: May 8, 2012 10:35 AM by Peyman Azimabadi RSS

    Pivoting in macro

    Peyman Azimabadi

      Hi all,

      how can i do "Pivoting" in VBScript macro?

      that means that for example, i have created a PivotTable with two dimensions in my macro and then i need to send one of this dimensions on horizontal axis.

       

      Best regards

      Peyman

        • Re: Pivoting in macro
          Peyman Azimabadi

          I have found the correct answer. It's like this :

           

           

          SUB mySUB
               SET chart = ActiveDocument.Activesheet.CreatePivotTable
               chart.AddDimension "Product"
               chart.AddDimension "Year"
               chart.AddExpression "sum(Amount)"
          
               cp = chart.GetProperties
               cp.TableProperties.NumberOfLeftDimensions = 1
               chart.SetProperties cp 
          END SUB